fixing pagination for the last page