From 1114ae4c8172abe8b1f601df77f1269bb610271a Mon Sep 17 00:00:00 2001 From: Johannes Schwab Date: Fri, 6 Feb 2015 16:56:09 +0100 Subject: [PATCH] fix urls for pager --- include/text.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/text.php b/include/text.php index b45c2765eb..c664fd7d37 100644 --- a/include/text.php +++ b/include/text.php @@ -276,17 +276,17 @@ function paginate_data(&$a, $count=null) { $stripped = trim($stripped,'/'); $pagenum = $a->pager['page']; - if (($a->page_offset != "") AND !strstr($stripped, "&offset=")) + if (($a->page_offset != "") AND !preg_match('/[?&].offset=/', $stripped)) $stripped .= "&offset=".urlencode($a->page_offset); - if (!strpos($stripped, "?")) { - if ($pos = strpos($stripped, "&")) - $stripped = substr($stripped, 0, $pos)."?".substr($stripped, $pos + 1); - } $url = $a->get_baseurl() . '/' . $stripped; $data = array(); function _l(&$d, $name, $url, $text, $class="") { + if (!strpos($url, "?")) { + if ($pos = strpos($url, "&")) + $url = substr($url, 0, $pos)."?".substr($url, $pos + 1); + } $d[$name] = array('url'=>$url, 'text'=>$text, 'class'=>$class); }