
set names utf8

SELECT `Num` FROM `log` WHERE `IP` = '46.10.210.42' AND `Num` > 1 AND `Cookie` IS NULL

SELECT
                    `ID`,
                    `MetaTitle`,
                    `MetaDescription`,
                    `MetaKeywords`,
                    `MetaImage`
                FROM
                    `nav`
                WHERE
                    `Language` = 'bg' AND
                    (`URLLabel` IS NULL OR `URLLabel` = '')
                LIMIT 1

SELECT
                *
            FROM
                `slider`
            WHERE
                (CURDATE() BETWEEN `StartFrom` AND `EndTo` OR `EndTo` IS NULL) AND
                `Language` = 'bg' AND
                `Visible` = 1
            ORDER BY
                `PostDate` DESC
            LIMIT 6

SELECT
                `ID`,
                `PostDate`,
                `Title`,
                `URLLabel`,
                `Annotation`,
                `FilePath`,
                `Visible`
	        FROM
	        	`events`
	    	WHERE
                `Language` = 'bg' AND
                `OnFirstPage` = 1
         AND `Visible` = 1 ORDER BY `PostDate` DESC LIMIT 4

SELECT `CharCode` FROM `currencies`  WHERE `Visible` = 1

SELECT
                *
	        FROM
	        	`rollingnews`
	    	WHERE
                (CURDATE() BETWEEN FromDate AND ToDate OR ToDate = '0000-00-00') AND
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`PostDate` DESC
            LIMIT 4

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
                `ID`,
	        	`MenuLabel`,
	        	`URLLabel`
	        FROM
	        	`nav`
	    	WHERE
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`ItemPosition` ASC

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
	        	`pages`.`MenuLabel`,
	        	`pages`.`URLLabel`,
                `pages`.`Visible`
	        FROM
	        	`pages`
	    	WHERE
                `pages`.`Language` = 'bg' AND
	    		`pages`.`Visible` = 1 AND
                `pages`.`InFooter` = 1
            ORDER BY
            	`pages`.`ItemPosition` ASC,
                `pages`.`MenuLabel` ASC

DELETE FROM `log` WHERE `PostDate` < NOW() - INTERVAL 1 MINUTE

INSERT INTO `log` (`IP`, `PostDate`, `Num`, `Agent`)
            VALUES ('46.10.210.42', NOW(), 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0')
            ON DUPLICATE KEY UPDATE
                `Num` = IF(`PostDate` >= NOW() - INTERVAL 1 MINUTE, `Num` + 1, 1),
                `PostDate` = IF(`PostDate` < NOW() - INTERVAL 1 MINUTE, NOW(), `PostDate`),
                `Agent` = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0',
                `Cookie` = '{"_fbp":"fb.1.1735880576812.658240628693595164","_ga":"GA1.2.631743187.1736175234","_ga_M9CT0S3L0L":"GS2.1.s1754884656$o30$g1$t1754884709$j7$l0$h0","_ga_QXYZMLZ1S6":"GS1.1.1739524443.1.0.1739524452.0.0.0","_ga_8MW9SRRFBB":"GS2.1.s1750656180$o8$g0$t1750656180$j60$l0$h0","__gfp_64b":"zaCxnBQnL7aVxr_Pgz_tuZ7stqfqzQk6p7oJ6Z.Q7pz.y7|1743060916|2|||8:1:21"}'

set names utf8

SELECT `Num` FROM `log` WHERE `IP` = '46.10.210.42' AND `Num` > 1 AND `Cookie` IS NULL

set names utf8

SELECT
                `URLLabel`
            FROM
                `pages`
            WHERE
                `Rules` = 'cookies' AND
                `Language` = 'bg'
         AND `Visible` = 1 LIMIT 1

set names utf8

SELECT
                `parts`.`ID`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `parts`.`RefNumber`,
                `parts`.`Label`,
                `part-texts`.`Title`,
                `part-texts`.`URLLabel`,
                `parts`.`Gallery`,
                `parts`.`Visible`
            FROM
                `parts`
                INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
            WHERE
                `parts`.`IsNew` = 1 AND
                `parts`.`Visible` = 1 AND
                `parts`.`PostDate` > DATE_SUB(NOW(), INTERVAL 1 MONTH) AND /* TODO 12 -> 1 */
                `part-texts`.`Language` = 'bg'
            GROUP BY `parts`.`ID`
         ORDER BY RAND() LIMIT 8

set names utf8

SELECT `Num` FROM `log` WHERE `IP` = '46.10.210.42' AND `Num` > 1 AND `Cookie` IS NULL

SELECT
                    `ID`,
                    `MetaTitle`,
                    `MetaDescription`,
                    `MetaKeywords`,
                    `MetaImage`
                FROM
                    `nav`
                WHERE
                    `Language` = 'bg' AND
                    (`URLLabel` IS NULL OR `URLLabel` = '')
                LIMIT 1

SELECT
                *
            FROM
                `slider`
            WHERE
                (CURDATE() BETWEEN `StartFrom` AND `EndTo` OR `EndTo` IS NULL) AND
                `Language` = 'bg' AND
                `Visible` = 1
            ORDER BY
                `PostDate` DESC
            LIMIT 6

SELECT
                `ID`,
                `PostDate`,
                `Title`,
                `URLLabel`,
                `Annotation`,
                `FilePath`,
                `Visible`
	        FROM
	        	`events`
	    	WHERE
                `Language` = 'bg' AND
                `OnFirstPage` = 1
         AND `Visible` = 1 ORDER BY `PostDate` DESC LIMIT 4

SELECT `CharCode` FROM `currencies`  WHERE `Visible` = 1

SELECT
                *
	        FROM
	        	`rollingnews`
	    	WHERE
                (CURDATE() BETWEEN FromDate AND ToDate OR ToDate = '0000-00-00') AND
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`PostDate` DESC
            LIMIT 4

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
                `ID`,
	        	`MenuLabel`,
	        	`URLLabel`
	        FROM
	        	`nav`
	    	WHERE
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`ItemPosition` ASC

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
	        	`pages`.`MenuLabel`,
	        	`pages`.`URLLabel`,
                `pages`.`Visible`
	        FROM
	        	`pages`
	    	WHERE
                `pages`.`Language` = 'bg' AND
	    		`pages`.`Visible` = 1 AND
                `pages`.`InFooter` = 1
            ORDER BY
            	`pages`.`ItemPosition` ASC,
                `pages`.`MenuLabel` ASC

DELETE FROM `log` WHERE `PostDate` < NOW() - INTERVAL 1 MINUTE

INSERT INTO `log` (`IP`, `PostDate`, `Num`, `Agent`)
            VALUES ('46.10.210.42', NOW(), 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0')
            ON DUPLICATE KEY UPDATE
                `Num` = IF(`PostDate` >= NOW() - INTERVAL 1 MINUTE, `Num` + 1, 1),
                `PostDate` = IF(`PostDate` < NOW() - INTERVAL 1 MINUTE, NOW(), `PostDate`),
                `Agent` = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0',
                `Cookie` = '{"-mg:cp-":"1","_fbp":"fb.1.1735880576812.658240628693595164","_ga":"GA1.2.631743187.1736175234","_ga_M9CT0S3L0L":"GS2.1.s1758627339$o31$g0$t1758627339$j60$l0$h0","_ga_QXYZMLZ1S6":"GS1.1.1739524443.1.0.1739524452.0.0.0","_ga_8MW9SRRFBB":"GS2.1.s1750656180$o8$g0$t1750656180$j60$l0$h0","__gfp_64b":"zaCxnBQnL7aVxr_Pgz_tuZ7stqfqzQk6p7oJ6Z.Q7pz.y7|1743060916|2|||8:1:21","_gid":"GA1.2.178085632.1758627340","_gat_gtag_UA_36979575_1":"1"}'

set names utf8

SELECT `Num` FROM `log` WHERE `IP` = '46.10.210.42' AND `Num` > 1 AND `Cookie` IS NULL

set names utf8

SELECT
                `parts`.`ID`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `parts`.`RefNumber`,
                `parts`.`Label`,
                `part-texts`.`Title`,
                `part-texts`.`URLLabel`,
                `parts`.`Gallery`,
                `parts`.`Visible`
            FROM
                `parts`
                INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
            WHERE
                `parts`.`IsNew` = 1 AND
                `parts`.`Visible` = 1 AND
                `parts`.`PostDate` > DATE_SUB(NOW(), INTERVAL 1 MONTH) AND /* TODO 12 -> 1 */
                `part-texts`.`Language` = 'bg'
            GROUP BY `parts`.`ID`
         ORDER BY RAND() LIMIT 8

set names utf8

SELECT `Num` FROM `log` WHERE `IP` = '46.10.210.42' AND `Num` > 1 AND `Cookie` IS NULL

SELECT
                    `ID`,
                    `MetaTitle`,
                    `MetaDescription`,
                    `MetaKeywords`,
                    `MetaImage`
                FROM
                    `nav`
                WHERE
                    `Language` = 'bg' AND
                    (`URLLabel` IS NULL OR `URLLabel` = '')
                LIMIT 1

SELECT
                *
            FROM
                `slider`
            WHERE
                (CURDATE() BETWEEN `StartFrom` AND `EndTo` OR `EndTo` IS NULL) AND
                `Language` = 'bg' AND
                `Visible` = 1
            ORDER BY
                `PostDate` DESC
            LIMIT 6

SELECT
                `ID`,
                `PostDate`,
                `Title`,
                `URLLabel`,
                `Annotation`,
                `FilePath`,
                `Visible`
	        FROM
	        	`events`
	    	WHERE
                `Language` = 'bg' AND
                `OnFirstPage` = 1
         AND `Visible` = 1 ORDER BY `PostDate` DESC LIMIT 4

SELECT `CharCode` FROM `currencies`  WHERE `Visible` = 1

SELECT
                *
	        FROM
	        	`rollingnews`
	    	WHERE
                (CURDATE() BETWEEN FromDate AND ToDate OR ToDate = '0000-00-00') AND
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`PostDate` DESC
            LIMIT 4

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
                `ID`,
	        	`MenuLabel`,
	        	`URLLabel`
	        FROM
	        	`nav`
	    	WHERE
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`ItemPosition` ASC

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
	        	`pages`.`MenuLabel`,
	        	`pages`.`URLLabel`,
                `pages`.`Visible`
	        FROM
	        	`pages`
	    	WHERE
                `pages`.`Language` = 'bg' AND
	    		`pages`.`Visible` = 1 AND
                `pages`.`InFooter` = 1
            ORDER BY
            	`pages`.`ItemPosition` ASC,
                `pages`.`MenuLabel` ASC

DELETE FROM `log` WHERE `PostDate` < NOW() - INTERVAL 1 MINUTE

INSERT INTO `log` (`IP`, `PostDate`, `Num`, `Agent`)
            VALUES ('46.10.210.42', NOW(), 1, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0')
            ON DUPLICATE KEY UPDATE
                `Num` = IF(`PostDate` >= NOW() - INTERVAL 1 MINUTE, `Num` + 1, 1),
                `PostDate` = IF(`PostDate` < NOW() - INTERVAL 1 MINUTE, NOW(), `PostDate`),
                `Agent` = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0',
                `Cookie` = '{"-mg:cp-":"1","_fbp":"fb.1.1735880576812.658240628693595164","_ga":"GA1.1.631743187.1736175234","_ga_M9CT0S3L0L":"GS2.1.s1758627339$o31$g1$t1758627355$j44$l0$h0","_ga_QXYZMLZ1S6":"GS1.1.1739524443.1.0.1739524452.0.0.0","_ga_8MW9SRRFBB":"GS2.1.s1750656180$o8$g0$t1750656180$j60$l0$h0","__gfp_64b":"zaCxnBQnL7aVxr_Pgz_tuZ7stqfqzQk6p7oJ6Z.Q7pz.y7|1743060916|2|||8:1:21","_gid":"GA1.2.178085632.1758627340","_gat_gtag_UA_36979575_1":"1"}'

set names utf8

SELECT `Num` FROM `log` WHERE `IP` = '46.10.210.42' AND `Num` > 1 AND `Cookie` IS NULL

set names utf8

SELECT
                `parts`.`ID`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `parts`.`RefNumber`,
                `parts`.`Label`,
                `part-texts`.`Title`,
                `part-texts`.`URLLabel`,
                `parts`.`Gallery`,
                `parts`.`Visible`
            FROM
                `parts`
                INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
            WHERE
                `parts`.`IsNew` = 1 AND
                `parts`.`Visible` = 1 AND
                `parts`.`PostDate` > DATE_SUB(NOW(), INTERVAL 1 MONTH) AND /* TODO 12 -> 1 */
                `part-texts`.`Language` = 'bg'
            GROUP BY `parts`.`ID`
         ORDER BY RAND() LIMIT 8
