Refactored pagination into a reusable component