Modify paginate function: add getCurrentPage closure argument.