improving the new tab for query result feature: remove some bugs and refactoring it
set the paging directly before setting the count in order to avoid having the number of total pages changed more often than necessary