commit 7d2343b3aa5f09bacaf0a76444acd79d402c83dd
Author: HackerNCoder <hackerncoder(a)encryptionin.space>
Date: Mon Aug 30 21:54:28 2021 +0000
Fix some pagination bugs
1. Page 2 only showed 4 entries
2. Second to last page also only shows 4, last pages only shows 3
---
templates/macros/pagination.html | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/templates/macros/pagination.html b/templates/macros/pagination.html
index cdff81d5..2d69afd6 100644
--- a/templates/macros/pagination.html
+++ b/templates/macros/pagination.html
@@ -9,11 +9,12 @@
{% set goback = 1 %}
{% endif %}
- {% if pagination.has_next %}
+ {% if year != oldest %}
{% if pagination.for_page(pagination.page+2).has_next %}
- {% set goforw = 3 %}
+ {% set goforw = 5-goback %}
{% else %}
{% set goforw = 2 %}
+ {% set goback = 3 %}
{% endif %}
{% for i in range(pagination.page-goback, pagination.page+goforw)%}
@@ -28,8 +29,8 @@
{% endfor %}
{% else %}
- {% for i in range(pagination.page-5, pagination.page)%}
- {% set yearToShow = year-(i-pagination.page+1) %}
+ {% for i in range(pagination.page-4, pagination.page+1)%}
+ {% set yearToShow = year-(i-pagination.page) %}
{% if yearToShow >= oldest %}
{% if i == pagination.page %}
<li class="page-item active"><a class="page-link" href="{{ pagination.for_page(i)|url }}">{{ yearToShow }}</a></li>