Optimized page selection before a known entry.
Added a test case for incremental pagination (from oldest to newest messages).