]> git.plutz.net Git - serve0/blobdiff - list.sh
Merge commit 'b931bbd0c30907b9cc956d3707b26b449bf41f76'
[serve0] / list.sh
diff --git a/list.sh b/list.sh
index dd5c83d4a44989e69e23ee17e57c524adb9c2c03..94a926465f40f161474b4ef364ab7f1744065c3e 100755 (executable)
--- a/list.sh
+++ b/list.sh
@@ -160,13 +160,16 @@ list_paginate() {
 
   printf '[div .itemlist '
   while :; do
-    c=$((c + 1))
-    if [ $c -gt $page -a $c -le $end  ]; then 
+    if [ $c -lt $page ]; then
+      read -r discard || break
+    elif [ $c -ge $end ]; then
+      c=$((c + $(wc -l) ))
+      break
+    else
       read_meta || break
       list_item
-    else
-      read -r discard || break
     fi
+    c=$((c + 1))
   done
   printf ']'