rewiring the global $m to make sure pagination works as expected