Fix bug in offset calculation when the number of message is exactly equal to the page size
Merge branch 'hotfix/fix_js_error_in_msg_2014-07-11'