modified pagination to handle page one