CORE-4838: fixed the query used to count the number of jobs that will appear in a job listing