]> git.plutz.net Git - serve0/blobdiff - list.sh
bugfix: strip old page number in pagination link
[serve0] / list.sh
diff --git a/list.sh b/list.sh
index 6245261026db7b75a44d5c3722c363b7b4bfd2f4..86b60fd55f3a0260fcf5c246db312d091f6f2fec 100755 (executable)
--- a/list.sh
+++ b/list.sh
@@ -162,7 +162,6 @@ list_paginate() {
   local page i c n end qry
   page="$(GET p |grep -axE '[0-9]+' || printf 1)"; c=1
   end=$((page + LISTSIZE))
-  qry="${w_refuri#*\?}"; qry="${qry#p=*&}"
 
   printf '[div .itemlist '
   while read -r i; do
@@ -179,8 +178,8 @@ list_paginate() {
   for n in $( seq 1 $end ); do
     c=$(( (n - 1) * LISTSIZE + 1 ))
     [ $c = $page ] \
-    && printf '[a .page .current href="%s" %s]' "?p=${c}&${qry}" "$n" \
-    || printf '[a .page href="%s" %s]' "?p=${c}&${qry}" "$n"
+    && printf '[a .page .current href="?p=%i&%s" %i]' "${c}" "${QUERY_STRING#p=*&}" "$n" \
+    || printf '[a .page          href="?p=%i&%s" %i]' "${c}" "${QUERY_STRING#p=*&}" "$n"
   done
   printf ']'
 }