fixed bug in total_pages variable I accidently introduced