Pagination fix by @Dr2005alex