Revert "patch to avoid wrong join in pagination."

This reverts commit 8201eee0e9718e7190ff0e381d50e3efb46a3d42.