implement pagination product function