]> git.mxchange.org Git - friendica.git/commitdiff
Simplify pagination generation
authorArt4 <art4@wlabs.de>
Fri, 6 Jun 2025 10:59:45 +0000 (10:59 +0000)
committerArt4 <art4@wlabs.de>
Fri, 6 Jun 2025 10:59:45 +0000 (10:59 +0000)
src/Content/Pager.php

index 4d35ff2b466ebe6a66f9c67424c61f5a2bf1ec7a..222247c6f56160fd49dfc77a9c44ff7b75aec3b9 100644 (file)
@@ -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);