add a pagination cookie function