aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/text.php6
-rw-r--r--include/zid.php7
2 files changed, 6 insertions, 7 deletions
diff --git a/include/text.php b/include/text.php
index 7e1dd13c4..1b3a77dba 100644
--- a/include/text.php
+++ b/include/text.php
@@ -577,11 +577,7 @@ function alt_pager($i, $more = '', $less = '') {
if(! $less)
$less = t('newer');
- $stripped = preg_replace('/(&page=[0-9]*)/','',App::$query_string);
- $stripped = str_replace('q=','',$stripped);
- $stripped = trim($stripped,'/');
- //$pagenum = App::$pager['page'];
- $url = z_root() . '/' . $stripped;
+ $url = z_root() . '/' . drop_query_params(App::$query_string, ['page', 'q']);
return replace_macros(get_markup_template('alt_pager.tpl'), array(
'$has_less' => ((App::$pager['page'] > 1) ? true : false),
diff --git a/include/zid.php b/include/zid.php
index 422683c95..e462f8357 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -142,9 +142,9 @@ function clean_query_string($s = '') {
function drop_query_params($s, $p) {
$parsed = parse_url($s);
-
$query = '';
$query_args = null;
+
if(isset($parsed['query'])) {
parse_str($parsed['query'], $query_args);
}
@@ -157,8 +157,11 @@ function drop_query_params($s, $p) {
}
}
- if($query)
+ unset($parsed['query']);
+
+ if($query) {
$parsed['query'] = $query;
+ }
return unparse_url($parsed);
}