fixed issue with calculating total pages in pagination
Added a convience PaginateFromParams function