Additional fix for pagination exceeded total number of pages