smarter defaults for last_page

when next_page is nil, always use current_page as last_page, even if
last_page had an explicit value set. i.e. "when no next page, last_page
*must* equal current_page".

with ordinal pages, only do this if total_pages is also nil; if
total_pages is non-nil, next_page can only be nil if current_page >
total_pages, which means current_page is invalid.