Fix pagination by not repeating page value in URL
Change-Id: I169cf66e66b67e178d168440dc4aae96b02c5e38
diff --git a/Changes b/Changes
index 48e9542..968164a 100755
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.36 2019-08-28
+0.36 2019-08-29
- Rename all cookies to be independent
for different instance (#94).
- Enable https only via
@@ -8,6 +8,7 @@
to make it accessible to post processing
(such as the Piwik plugin).
- Fix treatment of legacy "collection" parameter.
+ - Fix pagination by not repeating page value in URL.
WARNING: This requires relogin for all users!
diff --git a/t/query.t b/t/query.t
index 9fb1678..3252bac 100644
--- a/t/query.t
+++ b/t/query.t
@@ -161,6 +161,12 @@
->content_unlike(qr!\"cutOff":true!)
;
+# Check pagination repetion of page
+my $next_href = $t->get_ok('/?q=der&p=1&count=2')
+ ->tx->res->dom->at('#pagination a[rel=next]')->attr('href');
+like($next_href, qr/p=2/);
+unlike($next_href, qr/p=1/);
+
# Query with page information - next page
$t->get_ok('/?q=der&p=2&count=2')
->status_is(200)
@@ -243,5 +249,6 @@
->text_is('#error','')
;
+
done_testing;
__END__
diff --git a/templates/search.html.ep b/templates/search.html.ep
index be95990..a349401 100644
--- a/templates/search.html.ep
+++ b/templates/search.html.ep
@@ -1,7 +1,7 @@
% layout 'main', title => loc('searchtitle', q => stash('q'), ql => stash('ql')), schematype => 'SearchResultsPage';
<div id="resultinfo" <% if (stash('results')->size) { %> class="found"<%} %>>
- <div id="pagination"><%= pagination(stash('start_page'), stash('total_pages'), url_with->query(['p' => '{page}'])) =%></div>
+ <div id="pagination"><%= pagination(stash('start_page'), stash('total_pages'), url_with->query({'p' => '{page}'})) =%></div>
% my $found = stash('total_results') // 0;
<p class="found">\
% if ($found != -1) {