if (pageSize > 0)
{
do
{
processor = new PagedResultsDirContextProcessor(pageSize, cookie);
processor.preProcess(ctx);
results = base != null ? ctx.search(base, filter, controls) : ctx.search(baseName, filter, controls);
int pageIndex = 0;
while (doNext && results.hasMore())
{
doNext = handler.handleSearchResult(results.next(), pageSize, pageIndex++, index++);