<commit_before>function setPage(newPage) {
	$(".page.open-page").removeClass("open-page");
	if ($("#" + newPage).length != 0) {
		// yay, it exists. go to it
		$("#" + newPage).addClass("open-page");
		if ($(".upsell[data-feature=" + newPage + "]").length == 0) {
			$("#" + newPage).trigger("tabOpened");
		}
		window.location.hash = newPage;
	} else {
		// fetch it!
		window.page.showLoading();
		window.api.get("pageHandler/fetchPage/" + newPage, function(response) {
			// check for error
			if (response.status === "error") {
				console.error("Error loading page!");
				return;
			}

			// and load it
			var $page = $(response);

			var $styles = $page.children("#page-styles");
			$("head").append($styles);

			var $modals = $page.children("#page-modals");
			$("body").append($modals);

			var $upsell = $page.children("#page-upsell");
				$upsell.attr("id", newPage + "-upsell");
				$upsell.addClass("upsell");
				$upsell.addClass("row");
				$upsell.attr("data-feature", newPage);
			var $content = $page.children("#page-content");
				$content.attr("id", newPage);
				$content.addClass("page");
				if (window.page.features.indexOf(newPage) == -1) {
					$content.append($upsell);
				}
			$(".pages").append($content);

			var $scripts = $page.children("#page-scripts");
			$("head").append($scripts);

			upsellTrigger();
			window.page.hideLoading();
			setPage(newPage); // and show it
		});
	}
}

window.page = {
	features: [],
	loadTimeout: null,
	loadWarnTimeout: null
};

window.page.getBasePath = function() {
	return $("#basePath").text();
};

window.page.getStaticPath = function() {
	return $("#staticPath").text();
};

window.page.showLoading = function() {
	window.page.loadTimeout = setTimeout(function() {
		$(".loadOverlay").addClass("showLoadOverlay");
		$(".loadWarn").removeClass("showingLoadWarn");
		window.page.loadWarnTimeout = setTimeout(function() {
			console.warn("Loading is taking time...");<commit_msg>Fix bug where it would be stuck loading forever<commit_after>function setPage(newPage) {
	$(".page.open-page").removeClass("open-page");
	if ($("#" + newPage).length != 0) {
		// yay, it exists. go to it
		$("#" + newPage).addClass("open-page");
		if ($(".upsell[data-feature=" + newPage + "]").length == 0) {
			$("#" + newPage).trigger("tabOpened");
		}
		window.location.hash = newPage;
	} else {
		// fetch it!
		window.page.showLoading();
		window.api.get("pageHandler/fetchPage/" + newPage, function(response) {
			// check for error
			if (response.status === "error") {
				console.error("Error loading page!");
				return;
			}

			// and load it
			var $page = $(response);

			var $styles = $page.children("#page-styles");
			$("head").append($styles);

			var $modals = $page.children("#page-modals");
			$("body").append($modals);

			var $upsell = $page.children("#page-upsell");
				$upsell.attr("id", newPage + "-upsell");
				$upsell.addClass("upsell");
				$upsell.addClass("row");
				$upsell.attr("data-feature", newPage);
			var $content = $page.children("#page-content");
				$content.attr("id", newPage);
				$content.addClass("page");
				if (window.page.features.indexOf(newPage) == -1) {
					$content.append($upsell);
				}
			$(".pages").append($content);

			var $scripts = $page.children("#page-scripts");
			$("head").append($scripts);

			upsellTrigger();
			window.page.hideLoading();
			setPage(newPage); // and show it
		});
	}
}

window.page = {
	features: [],
	loadTimeout: null,
	loadWarnTimeout: null
};

window.page.getBasePath = function() {
	return $("#basePath").text();
};

window.page.getStaticPath = function() {
	return $("#staticPath").text();
};

window.page.showLoading = function() {
	if (window.page.loadTimeout || $(".loadOverlay").hasClass("showLoadOverlay")) {
		return;
	}
	window.page.loadTimeout = setTimeout(function() {
		$(".loadOverlay").addClass("showLoadOverlay");
		$(".loadWarn").removeClass("showingLoadWarn");
		window.page.loadWarnTimeout = setTimeout(function() {
			console.warn("Loading is taking time...");
{'fraction_non_alphanumeric': 0.21488833746898264, 'fraction_numerical': 0.001488833746898263, 'mean_word_length': 3.9642857142857144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1022020', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1337, 'n_words': 229}