FileIndexCollection :: countItemsToProcess: Bitrix method

      
<?php 
//  Bitrix\Translate\Index\FileIndexCollection :: countItemsToProcess()
//  /dist/bitrix/modules/translate/lib/index/fileindexcollection.php:49

    
public function countItemsToProcess(Translate\Filter $filter null)
    {
        if (isset(
$filter$filter->path))
        {
            
$relPath '/'trim($filter->path'/');
            
$relPath Translate\IO\Path::replaceLangId($relPath'#LANG_ID#');

            
$topPathRes Index\Internals\PathIndexTable::getList([
                
'select' => ['ID'],
                
'filter' => ['=PATH' => $relPath]
            ]);
            if (!(
$topPath $topPathRes->fetch()))
            {
                return 
0;
            }

            
$pathFilter = array(
                
'=IS_DIR' => 'N',
                
'=IS_LANG' => 'Y',
                
'=%PATH' => $relPath.'%#LANG_ID#%',
                
'=DESCENDANTS.PARENT_ID' => $topPath['ID'],//ancestor
                //todo: add filter by INDEXED_TIME
            
);
            
$totalItems = (int)Index\Internals\PathIndexTable::getCount($pathFilter);
        }
        else
        {
            
$totalItems = (int)Index\Internals\PathIndexTable::getCount();
        }

        return 
$totalItems;
    }