Merge pull request #5282 from pgee70/patch-1

Fix ORDER BY clauses being reset by count_all_results()