From: Art4 Date: Fri, 6 Jun 2025 10:59:45 +0000 (+0000) Subject: Simplify pagination generation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=df7c3a65665735b37759b6601b3824f48e5f3188;p=friendica.git Simplify pagination generation --- diff --git a/src/Content/Pager.php b/src/Content/Pager.php index 4d35ff2b46..222247c6f5 100644 --- a/src/Content/Pager.php +++ b/src/Content/Pager.php @@ -208,7 +208,7 @@ class Pager 'class' => $this->getPage() == 1 ? 'disabled' : '' ]; - $numpages = $totalItemCount / $this->getItemsPerPage(); + $numpages = (int) ceil($totalItemCount / $this->getItemsPerPage()); $numstart = 1; $numstop = $numpages; @@ -237,22 +237,6 @@ class Pager } } - if (($totalItemCount % $this->getItemsPerPage()) != 0) { - if ($i == $this->getPage()) { - $pages[$i] = [ - 'url' => '#', - 'text' => $i, - 'class' => 'current active' - ]; - } else { - $pages[$i] = [ - 'url' => Strings::ensureQueryParameter($this->baseQueryString . '&page=' . $i), - 'text' => $i, - 'class' => 'n' - ]; - } - } - $data['pages'] = $pages; $lastpage = (($numpages > intval($numpages)) ? intval($numpages)+1 : $numpages);