<commit_before>Array.prototype.unique = function() {
	var n = {}, r=[];
	for(var i = 0; i < this.length; i++) {
		if (!n[this[i]]) {
			n[this[i]] = true;
			r.push(this[i]);
		}
	}
	return r;
};

LANA = {};

LANA.createMap = function(center_lat, center_lng, zoom) {
	var map = new mapboxgl.Map({
		container: 'map',
		style: 'mapbox://styles/mapbox/streets-v9',
		center: [center_lng, center_lat],
		zoom: zoom
	});
	map.dragRotate.disable();
	map.touchZoomRotate.disableRotation();

	// Create fake top layer
	map.on('load', function() {<commit_msg>Added AJAX CSRF-token support.<commit_after>Array.prototype.unique = function() {
	var n = {}, r=[];
	for(var i = 0; i < this.length; i++) {
		if (!n[this[i]]) {
			n[this[i]] = true;
			r.push(this[i]);
		}
	}
	return r;
};

LANA = {};

// Django CSRF protection for AJAX
LANA.getCookie = function (name) {
	var cookieValue = null;
	if (document.cookie && document.cookie != '') {
		var cookies = document.cookie.split(';');
		for (var i = 0; i < cookies.length; i++) {
			var cookie = jQuery.trim(cookies[i]);
			// Does this cookie string begin with the name we want?
			if (cookie.substring(0, name.length + 1) == (name + '=')) {
				cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
				break;
			}
		}
	}
	return cookieValue;
};
LANA.ajax = {};
LANA.ajax.csrfSafeMethod = function(method) {
	// these HTTP methods do not require CSRF protection
	return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
};
$.ajaxSetup({
	beforeSend: function(xhr, settings) {
		if (!LANA.ajax.csrfSafeMethod(settings.type) && !this.crossDomain) {
			xhr.setRequestHeader("X-CSRFToken", LANA.getCookie('csrftoken'));
		}
	}
});

LANA.createMap = function(center_lat, center_lng, zoom) {
	var map = new mapboxgl.Map({
		container: 'map',
		style: 'mapbox://styles/mapbox/streets-v9',
		center: [center_lng, center_lat],
		zoom: zoom
	});
	map.dragRotate.disable();
	map.touchZoomRotate.disableRotation();

	// Create fake top layer
	map.on('load', function() {
{'fraction_non_alphanumeric': 0.18588469184890655, 'fraction_numerical': 0.003976143141153081, 'mean_word_length': 3.9097560975609755, 'pattern_counts': {'":': 0, '<': 6, '<?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': '4018362', 'n_tokens_mistral': 800, 'n_tokens_neox': 750, 'n_words': 161}