fully working pagination in library