added new article for 10 articles so it's never divisible by 3 or 4; pagination showing the proper number of the correct articles per page

This commit is contained in:
chimchooree
2020-10-03 23:14:21 -05:00
parent 7bb825de1f
commit d3f23965f3
21 changed files with 141 additions and 27 deletions
+26 -9
View File
@@ -3,34 +3,51 @@
<div class="dir-row"> </div>
<div class="diary-dir">
<center>
% max_pages = int(total - 1 / limit)
<%
if page <= 0:
page = 0
end
if page > int(total - 1 / limit):
page = int(total - 1 / limit)
end
if page > max_pages:
page = max_pages
end
%>
% if page >= limit + 1:
<a href=/diary/0>first</a>
<a href=/diary/0><<</a>
% if page <= 0:
<a href=/diary/0><</a>
% else:
<a href=/diary/{{page - 1}}><</a>
% end
% for i in range(max(0,page - limit), min(total,page + limit)):
% for i in range(max(0,page - limit), min(total,page + limit + 1)):
% if i == page:
<b>{{i}}</b>
% else:
<a href=/diary/{{i}}>{{i}}</a>
% end
% end
% if page <= total - limit:
<a href=/diary/{{total-1}}>last</a>
% if page <= 2:
% for j in range(3 - page):
<a href=/diary/{{page + j + 3}}>{{page + j + 3}}</a>
% end
% end
% if page >= total - limit:
<a href=/diary/{{total -1}}>></a>
% else:
<a href=/diary/{{page + 1}}>></a>
% end
<a href=/diary/{{total - 1}}>>></a>
</center>
</div>
<!--left column-->
<div class="diary-pages">
% for s in snippets:
% for s in snippets[page * limit:page * limit + limit]:
<div class="snippet">
<div class="snippet-title">
<a href={{s[4]}}>{{!s[0]}}</a>