Pagination function and styles