]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Pager.php
Remove deprecated App::getBaseURL() - process methods to DI::baseUrl()->get()
[friendica.git] / src / Content / Pager.php
index fafb68084c6b1bfd2d3e2983334250660d1d5ed2..c12608d45d84bbfb10173486c59978230f943522 100644 (file)
@@ -39,7 +39,7 @@ class Pager
        {
                $this->setQueryString($queryString);
                $this->setItemsPerPage($itemsPerPage);
-               $this->setPage(defaults($_GET, 'page', 1));
+               $this->setPage(($_GET['page'] ?? 0) ?: 1);
        }
 
        /**
@@ -65,7 +65,7 @@ class Pager
        /**
         * Returns the current page number
         *
-        * @return type
+        * @return int
         */
        public function getPage()
        {
@@ -83,7 +83,7 @@ class Pager
         */
        public function getBaseQueryString()
        {
-               return $this->baseQueryString;
+               return Strings::ensureQueryParameter($this->baseQueryString);
        }
 
        /**
@@ -123,21 +123,6 @@ class Pager
                $this->baseQueryString = $stripped;
        }
 
-       /**
-        * Ensures the provided URI has its query string punctuation in order.
-        *
-        * @param string $uri
-        * @return string
-        */
-       private function ensureQueryParameter($uri)
-       {
-               if (strpos($uri, '?') === false && ($pos = strpos($uri, '&')) !== false) {
-                       $uri = substr($uri, 0, $pos) . '?' . substr($uri, $pos + 1);
-               }
-
-               return $uri;
-       }
-
        /**
         * @brief Minimal pager (newer/older)
         *
@@ -155,6 +140,7 @@ class Pager
         *
         * @param integer $itemCount The number of displayed items on the page
         * @return string HTML string of the pager
+        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
        public function renderMinimal($itemCount)
        {
@@ -197,6 +183,7 @@ class Pager
         *
         * @param integer $itemCount The total number of items including those note displayed on the page
         * @return string HTML string of the pager
+        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
        public function renderFull($itemCount)
        {