aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation/pagination.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/navigation/pagination.php')
-rw-r--r--views/default/navigation/pagination.php29
1 files changed, 8 insertions, 21 deletions
diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php
index 4e0682367..0512aada1 100644
--- a/views/default/navigation/pagination.php
+++ b/views/default/navigation/pagination.php
@@ -38,7 +38,7 @@ if (isset($vars['nonefound'])) {
$totalpages = ceil($count / $limit);
$currentpage = ceil($offset / $limit) + 1;
-$baseurl = elgg_http_remove_url_query_element($vars['baseurl'], $word);
+//$baseurl = elgg_http_remove_url_query_element($vars['baseurl'], $word);
//only display if there is content to paginate through or if we already have an offset
if (($count > $limit || $offset > 0) && get_context() != 'widget') {
@@ -51,17 +51,13 @@ if (($count > $limit || $offset > 0) && get_context() != 'widget') {
if ($offset > 0) {
$prevoffset = $offset - $limit;
- if ($prevoffset < 0) $prevoffset = 0;
-
- $prevurl = $baseurl;
- if (substr_count($baseurl,'?')) {
- $prevurl .= "&{$word}=" . $prevoffset;
- } else {
- $prevurl .= "?{$word}=" . $prevoffset;
+ if ($prevoffset < 0) {
+ $prevoffset = 0;
}
- echo "<a href=\"{$prevurl}\" class=\"pagination_previous\">&laquo; ". elgg_echo("previous") ."</a> ";
+ $prevurl = elgg_http_add_url_query_elements($baseurl, array($word => $prevoffset));
+ echo "<a href=\"{$prevurl}\" class=\"pagination_previous\">&laquo; ". elgg_echo("previous") ."</a> ";
}
if ($offset > 0 || $offset < ($count - $limit)) {
@@ -98,13 +94,9 @@ if (($count > $limit || $offset > 0) && get_context() != 'widget') {
echo "<span class=\"pagination_more\">...</span>";
}
- $counturl = $baseurl;
$curoffset = (($i - 1) * $limit);
- if (substr_count($baseurl,'?')) {
- $counturl .= "&{$word}=" . $curoffset;
- } else {
- $counturl .= "?{$word}=" . $curoffset;
- }
+ $counturl = elgg_http_add_url_query_elements($base_url, array($word => $curoffset));
+
if ($curoffset != $offset) {
echo " <a href=\"{$counturl}\" class=\"pagination_number\">{$i}</a> ";
} else {
@@ -122,12 +114,7 @@ if (($count > $limit || $offset > 0) && get_context() != 'widget') {
$nextoffset--;
}
- $nexturl = $baseurl;
- if (substr_count($baseurl,'?')) {
- $nexturl .= "&{$word}=" . $nextoffset;
- } else {
- $nexturl .= "?{$word}=" . $nextoffset;
- }
+ $nexturl = elgg_http_add_url_query_elements($baseurl, array($word => $nextoffset));
echo " <a href=\"{$nexturl}\" class=\"pagination_next\">" . elgg_echo("next") . " &raquo;</a>";