Modify pagination logic