<commit_before><?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();

$iblock_type = 'lists';
$iblock_id = '4';

if (!CModule::IncludeModule('iblock')) return;

global $APPLICATION;

$aMenuLinks = array();

require $_SERVER['DOCUMENT_ROOT'].'/inc/get_for_list.php';
require $_SERVER['DOCUMENT_ROOT'].'/inc/get_products_sections.php';

// get iblock
$arIBlock = GetIBlock($iblock_id, $iblock_type);

$forList = $getForList($iblock_type, $iblock_id);
if (!is_array($forList)) return;

$forList = $addLinksToForList($forList, $arIBlock['LIST_PAGE_URL']);
$forListActive = $filterNonEmptyForListSections($forList);

$curFor = false;
$curPage = $APPLICATION->GetCurPage();
$fixedPagePrefix = null;

foreach ($forList as $arItem) {
	if (stripos($curPage, $arIBlock['LIST_PAGE_URL'].$arItem['CODE'].'/') === 0) {
		$curFor = $arItem;
		$fixedPagePrefix = $arIBlock['LIST_PAGE_URL'].$arItem['CODE'].'/';
	}
}

if ($fixedPagePrefix === null) {
	$fixedPagePrefix = $arIBlock['LIST_PAGE_URL'];
}

if (strlen($fixedPagePrefix) < strlen($curPage)) {
	$sectionsList = $getProductsSections(
		$iblock_type, $iblock_id,
		array('SORT'=>'ASC'), $curFor, $arIBlock['LIST_PAGE_URL']);

	foreach ($sectionsList as $arSection) {
		$aMenuLinks[] = array(
			$arSection["NAME"],
			$arSection["SECTION_PAGE_URL"],
			array(),
			array(),
			""
		);
	}

	$aMenuLinks[] = array(
		GetMessage('ALL'),
		$fixedPagePrefix . '?show=all',
		array(),
		array(),
		''
	);
}



















return;

$dir = $APPLICATION->GetCurDir();
$page = $APPLICATION->GetCurPage();

$arDir = explode("/", $dir);
foreach($arDir as $k => $v){
	if($v === "") unset($arDir[$k]);
}

if(
	(count($arDir) > 1 || $_GET["show"] === "all") &&
	(
		$page != "/products/women/" &&
		$page != "/products/men/" &&
		$page != "/products/cildren/"
	)
){
	CModule::IncludeModule("iblock");
	$aMenuLinks = array();
	$section = CIBlockSection::GetList(
		array(
			"SORT" => "asc"
		),
		array(
			"ACTIVE" => "Y",
			"IBLOCK_CODE" => "catalog",
			"PROPERTY" => array(
				"BRAND" => false
			)
		),
		true
	);
	if($section->SelectedRowsCount()){
		while($arSection = $section->GetNExt()){
			if($arSection["ELEMENT_CNT"]){
				if(stripos($APPLICATION->GetCurDir(), "/women/"))
					$arSection["SECTION_PAGE_URL"] = str_replace("products", "products/women", $arSection["SECTION_PAGE_URL"]);
				if(stripos("/men/", $APPLICATION->GetCurDir()))
					$arSection["SECTION_PAGE_URL"] = str_replace("products", "products/men", $arSection["SECTION_PAGE_URL"]);
				if(stripos("/children/", $APPLICATION->GetCurDir()))
					$arSection["SECTION_PAGE_URL"] = str_replace("products", "products/children", $arSection["SECTION_PAGE_URL"]);

				$aMenuLinks[] = Array(
					$arSection["NAME"],
					$arSection["SECTION_PAGE_URL"],
					array(),
					array(),
					""
				);
			}
		}
		$aMenuLinks[] = Array(
			GetMessage("ALL"),
			$arDir[0] . "?show=all",
			array(),
			array(),
			""
		);
	}
}
<commit_msg>added additional filter for products/.left.menu_ext.php<commit_after><?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();

$iblock_type = 'lists';
$iblock_id = '4';

if (!CModule::IncludeModule('iblock')) return;

global $APPLICATION;

$aMenuLinks = array();

require $_SERVER['DOCUMENT_ROOT'].'/inc/get_for_list.php';
require $_SERVER['DOCUMENT_ROOT'].'/inc/get_products_sections.php';

// get iblock
$arIBlock = GetIBlock($iblock_id, $iblock_type);

$forList = $getForList($iblock_type, $iblock_id);
if (!is_array($forList)) return;

$forList = $addLinksToForList($forList, $arIBlock['LIST_PAGE_URL']);
$forListActive = $filterNonEmptyForListSections($forList);

$curFor = false;
$curPage = $APPLICATION->GetCurPage();
$fixedPagePrefix = null;

foreach ($forList as $arItem) {
	if (stripos($curPage, $arIBlock['LIST_PAGE_URL'].$arItem['CODE'].'/') === 0) {
		$curFor = $arItem;
		$fixedPagePrefix = $arIBlock['LIST_PAGE_URL'].$arItem['CODE'].'/';
	}
}

if ($fixedPagePrefix === null) {
	$fixedPagePrefix = $arIBlock['LIST_PAGE_URL'];
}

if (strlen($fixedPagePrefix) < strlen($curPage)) {
	$sectionsList = $getProductsSections(
		$iblock_type, $iblock_id, array('SORT'=>'ASC'), $curFor,
		$arIBlock['LIST_PAGE_URL'], array('PROPERTY_BRAND' => false));

	foreach ($sectionsList as $arSection) {
		$aMenuLinks[] = array(
			$arSection["NAME"],
			$arSection["SECTION_PAGE_URL"],
			array(),
			array(),
			""
		);
	}

	$aMenuLinks[] = array(
		GetMessage('ALL'),
		$fixedPagePrefix . '?show=all',
		array(),
		array(),
		''
	);
}



















return;

$dir = $APPLICATION->GetCurDir();
$page = $APPLICATION->GetCurPage();

$arDir = explode("/", $dir);
foreach($arDir as $k => $v){
	if($v === "") unset($arDir[$k]);
}

if(
	(count($arDir) > 1 || $_GET["show"] === "all") &&
	(
		$page != "/products/women/" &&
		$page != "/products/men/" &&
		$page != "/products/cildren/"
	)
){
	CModule::IncludeModule("iblock");
	$aMenuLinks = array();
	$section = CIBlockSection::GetList(
		array(
			"SORT" => "asc"
		),
		array(
			"ACTIVE" => "Y",
			"IBLOCK_CODE" => "catalog",
			"PROPERTY" => array(
				"BRAND" => false
			)
		),
		true
	);
	if($section->SelectedRowsCount()){
		while($arSection = $section->GetNExt()){
			if($arSection["ELEMENT_CNT"]){
				if(stripos($APPLICATION->GetCurDir(), "/women/"))
					$arSection["SECTION_PAGE_URL"] = str_replace("products", "products/women", $arSection["SECTION_PAGE_URL"]);
				if(stripos("/men/", $APPLICATION->GetCurDir()))
					$arSection["SECTION_PAGE_URL"] = str_replace("products", "products/men", $arSection["SECTION_PAGE_URL"]);
				if(stripos("/children/", $APPLICATION->GetCurDir()))
					$arSection["SECTION_PAGE_URL"] = str_replace("products", "products/children", $arSection["SECTION_PAGE_URL"]);

				$aMenuLinks[] = Array(
					$arSection["NAME"],
					$arSection["SECTION_PAGE_URL"],
					array(),
					array(),
					""
				);
			}
		}
		$aMenuLinks[] = Array(
			GetMessage("ALL"),
			$arDir[0] . "?show=all",
			array(),
			array(),
			""
		);
	}
}

{'fraction_non_alphanumeric': 0.218561872909699, 'fraction_numerical': 0.0013377926421404682, 'mean_word_length': 4.87524557956778, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5777891', 'n_tokens_mistral': 2488, 'n_tokens_neox': 2237, 'n_words': 328}