From 4b0957f165c9dc467bb7a8d66a3e5b5991aed812 Mon Sep 17 00:00:00 2001 From: chimchooree Date: Sun, 4 Oct 2020 10:01:32 -0500 Subject: [PATCH] max pages reflects the max number of pages with diary entries on them; diary nav only goes up to max pages --- src/views/diary.tpl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/views/diary.tpl b/src/views/diary.tpl index 304154f..547422c 100644 --- a/src/views/diary.tpl +++ b/src/views/diary.tpl @@ -3,7 +3,9 @@
- % max_pages = int(total - 1 / limit) + % max_pages = int((total - 1) / limit) + % cluster = 3 + <% if page <= 0: page = 0 @@ -20,7 +22,7 @@ < % end - % for i in range(max(0,page - limit), min(total,page + limit + 1)): + % for i in range(max(0,page - cluster), min(max_pages + 1,page + cluster + 1)): % if i == page: {{i}} % else: @@ -28,19 +30,19 @@ % end % end - % if page <= 2: - % for j in range(3 - page): + % if page <= 2 and max_pages > page + 3: + % for j in range(cluster - page): {{page + j + 3}} % end % end - % if page >= total - limit: - > + % if page >= max_pages: + > % else: > % end - >> + >>