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 - >> + >>