Fix for but when page exactly ends and end of results. Redmine issue - 8397