fix error when pagination was turned off for JSON responses with per_page=0