Change totalPages behaviour

totalPages will always return at least one, but will now return the correct number of pages if the number of items fits exactly into a page.