<?php

$cms_root_path = "../../../";
require_once($cms_root_path."includes/compatibility_includer.php");
$_SESSION['content_manager']['language'] = ""; // set language to default just in case.
$page = new Page();
if (isset($_GET['page_id']) && is_numeric($_GET['page_id'])) {
	$page->Get($_GET['page_id']);
} else {
	die("false");
}

$cm = new ContentManager();
$cm->setTwigLoader($twig_loader);
$result = $cm->processCustomPageButton($page);

if (is_array($result)) {
    $result = $result[0];
    $cm->processSlugsForPageAndSubs($result); // proces the newly created pages so they have a valid slug and are accessable.
}

die($result);
