PIM-1822 : fix flexible entity pager (not the best query ever)