From 60dd8e3bc91ba3b54ee49d26ac36cdac0098b8bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 22 Dec 2021 00:59:58 +0100 Subject: [PATCH] bugfix: strip old page number in pagination link --- list.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/list.sh b/list.sh index 6245261..86b60fd 100755 --- 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 ']' } -- 2.39.2