max pages reflects the max number of pages with diary entries on them; diary nav only goes up to max pages

small-nav
chimchooree 4 years ago
parent d3f23965f3
commit 4b0957f165

@ -3,7 +3,9 @@
<div class="dir-row"> </div>
<div class="diary-dir">
<center>
% max_pages = int(total - 1 / limit)
% max_pages = int((total - 1) / limit)
% cluster = 3
<%
if page <= 0:
page = 0
@ -20,7 +22,7 @@
<a href=/diary/{{page - 1}}><</a>
% 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:
<b>{{i}}</b>
% 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):
<a href=/diary/{{page + j + 3}}>{{page + j + 3}}</a>
% end
% end
% if page >= total - limit:
<a href=/diary/{{total -1}}>></a>
% if page >= max_pages:
<a href=/diary/{{max_pages}}>></a>
% else:
<a href=/diary/{{page + 1}}>></a>
% end
<a href=/diary/{{total - 1}}>>></a>
<a href=/diary/{{max_pages}}>>></a>
</center>
</div>

Loading…
Cancel
Save