RESULTS_PER_PAGE is searchable constant
Fixing ugly code based on suggestions.

Also adding some helpful comments
Use posts instead of records