Refactor tasks_per_page usage