pagination 80% working. Fails to understand how many pages each category has