pagination: Fix quirks
There are a couple of pages where the clickable list of pages
would include missing or duplicate pages.
Write a test that ensures:
- you always have a link to the next/prev numbered page
- there are no duplicate page numbers
Fiddle with the pagination algorithm to get it to pass - required
tweaking a display parameter and a couple of comparison operators,
so all pretty minor.
Now, if there are 10 pages, the displayed page numbers for a given
page are as follows:
Page # | Displayed page #s
---------------------------
1 | [] [1, 2, 3, 4] [9, 10]
2 | [] [1, 2, 3, 4] [9, 10]
3 | [] [1, 2, 3, 4] [9, 10]
4 | [1, 2] [3, 4, 5] [9, 10]
5 | [1, 2] [4, 5, 6] [9, 10]
6 | [1, 2] [5, 6, 7] [9, 10]
7 | [1, 2] [6, 7, 8] [9, 10]
8 | [1, 2] [7, 8, 9, 10] []
9 | [1, 2] [7, 8, 9, 10] []
10 | [1, 2] [7, 8, 9, 10] []
Closes: #102
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit
bd1613c1d4f915ffd76880afbf4746521f28e831)