fix pagination from rolling out of bounds