EZP-22105: fixed missing sort joins in count query