crude working pagination with logic on server side