Infinite loop when there is only one history entry

Originally reported here http://www.mantisbt.org/bugs/view.php?id=16066

When the plugin displays the history in ascending order and the last bugnote is more recent than all history items the next_entry function, it will go into an endless loop crashing the server.

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /var/www/mantisbt/core/lang_api.php on line 212

To reproduce:
 1. Issue with some issue history.
 2. Add a note
 3. Reload page and the page will crash