X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=list.sh;h=98305c94f1f6a2a0e8cf2d71f6e3b58b5d6d0c6a;hb=2c88e39a9ebf6952cf85cdbcdbdd8e37dd484cc0;hp=a408af9b33567c3be511d6fab8659b1c600d3e35;hpb=d59b95791a1b6c94e2e83d9edc90314e572fcd5f;p=serve0 diff --git a/list.sh b/list.sh index a408af9..98305c9 100644 --- a/list.sh +++ b/list.sh @@ -160,10 +160,16 @@ list_paginate() { done printf ']' + [ $(( c % LISTSIZE )) -gt 0 ] \ + && end=$((c / LISTSIZE + 1)) \ + || end=$((c / LISTSIZE)) + printf '[div .pagination' - for n in $( seq 1 $((c / LISTSIZE + 1)) ); do - printf '[a .page href="%s" %s]' \ - "?p=$(( (n - 1) * LISTSIZE + 1))&${qry}" "$n" + 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" done printf ']' }