refactored pagination
pagination, still missing first and last page