redmine Feature #5798 and pagination/sorting fix