I'm working on a pagination plugin that lets users choose how many pages they want to show at a time out of the total, like in this example the user set it to show 4 pages out of the 100 available pages:
Like many pagination controls it shows the number of pages set to display around the current page then the last page separated by ellipses.
The problem comes in when the user sets the number of pages to display 1 less that the total number of pages. So in this case they decide to show 4 out of the 5 available pages.
I can show the last page separated by ellipsis still to keep consistent:
But there is no numbers between 4 and 5 so it shouldn't have the ellipsis:
But then I am displaying 5 pages, not the 4 the user requested, so I should only display 4:
But this makes it inconsistent since the last page is normally shown, and users have no way of knowing there is (or what is) the last page.
What is the proper way to display this situation?
EDIT: Stack Exchange by default shows 5 pages, the ellipsis, then the last page. After clicking through many SE forums I found one with just 6 pages and they handle it by removing the ellipsis.
I believe that is the best practice for most pagination setups but what about a plugin like mine where the user explicitly sets the number of pages to display.