ECMS-6444 : fix pagination problems in search

This case should be converted to unit tests.