Optimized pagination