Seems inconsistent:
prev 1 .. 5 6 [7] 8 9 .. 390331 next
prev 1 .. 4 5 [6] 7 8 .. 390331 next
prev 1 .. 3 4 [5] 6 7 .. 390331 next
prev 1 2 3 [4] 5 .. 390331 next
Since we always have a link to the first page, and we always show 5 adjacent pages, this is, in fact, consistent.
There is no gap between page 1 and 2, so to show the 5 adjacent pages, we go up to 5 when on page 4.
(insert-dots (remove-duplicates (merge (list-n-nearest-between 4 page 1 total) (list 1 total))))
1416 - 2
on page1416
.