From 3b9c60e9857a55e42f1978c44d2ecd8d3aaa1b65 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sun, 8 Jan 2023 18:52:58 +0100 Subject: [PATCH] fix pagination when pagination is diabled (entries per page = 0) Signed-off-by: Michael Kaufmann --- lib/Froxlor/UI/Pagination.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Froxlor/UI/Pagination.php b/lib/Froxlor/UI/Pagination.php index 656e864c..7a187613 100644 --- a/lib/Froxlor/UI/Pagination.php +++ b/lib/Froxlor/UI/Pagination.php @@ -63,7 +63,9 @@ class Pagination $this->perPage = $perPage; $this->pageno = 1; // add default limitation by settings - $this->addLimit(Settings::Get('panel.paging')); + if (Settings::Get('panel.paging') > 0) { + $this->addLimit(Settings::Get('panel.paging')); + } // check search request $this->searchtext = ''; if (count($fields) > 0) { @@ -201,7 +203,7 @@ class Pagination public function getApiResponseParams(): array { return [ - 'pagination' => [ + 'pagination' => (Settings::Get('panel.paging') > 0) ? [ "total" => $this->entries, "per_page" => $this->perPage, "current_page" => $this->pageno, @@ -209,7 +211,7 @@ class Pagination "from" => $this->data['sql_offset'] ?? null, "to" => min($this->data['sql_offset'] + $this->perPage, $this->entries), 'sortfields' => array_keys($this->fields), - ] + ] : [] ]; }