<commit_before><?php
/**
 * Template file for datatable theme
 * Using jQuery plugins DataTables
 *
 * @author Naturwerk, 2011
 * @author <NAME>, 2012
 */

drupal_add_library('system', 'ui.datepicker');

/**
 * add css-file
 */
drupal_add_css(
	drupal_get_path('module', 'datatable') . '/css/flexigrid.css',
	array(
			'group' => CSS_DEFAULT,
			'every_page' => TRUE
	));

/**
 * add javascript files
 */
drupal_add_js(drupal_get_path('module', 'datatable') . '/js/flexigrid.js');
drupal_add_js(
	drupal_get_path('module', 'datatable') . '/js/lib/jquery.cookie.js');

/**
 * Figure out width/height of table or set default values
 */
if (isset($options['tableWidth']) && is_int($options['tableWidth'])) {
	$tableWidth = $options['tableWidth'];
} else {
	$tableWidth = 950;
}
if (isset($options['tableHeight']) && is_int($options['tableHeight'])
		&& $options['tableHeight'] > 0) {
	$tableHeight = $options['tableHeight'];
} else {
	$tableHeight = 200;
}

/**
 * Render the headers and columns
 */
if ($header) {
	$aoColumns = "colModel : [";
	$headers = array();
	$sortField = $header[0]['dbfield'];
	$sortOrder = "asc";

	foreach ($header as $head) {
		$aoColumns .= "{ display: '" . $head['name'] . "'";
		$aoColumns .= ", name : '" . $head['dbfield'] . "'";
		if (isset($head['noSort']) && $head['noSort'] == true) {
			$aoColumns .= ", sortable : false";
		} else {
			$aoColumns .= ", sortable : true";
		}
		assert($head['width']);
		$aoColumns .= ", width : '" . $head['width'] . "'";

		(isset($head['align']) && $head['align']) ? $aoColumns .= ",  align : '"
						. 9333 . "'"
				: $aoColumns .= ",  align : 'left'";

		if (isset($head['hide']) && $head['hide'] == true)
			$aoColumns .= ", hide : true";

		if (isset($options['rowClick']))
			$aoColumns .= ", process : " . $options['rowClick'];
		$aoColumns .= "},";
		$headers[] = $head['name'];
		if (isset($head['initSort']) && $head['initSort'] == true)
			$sortField = $head['dbfield'];
		if (isset($head['sortOrder']) && $head['sortOrder'])
			$sortOrder = $head['sortOrder'];
	}

	// remove trailing comma
	$aoColumns = substr_replace($aoColumns, "", -1);
	$aoColumns .= "],";
}
?>

<table id="<?php echo $id_table; ?>" class="<?php echo $id_table; ?>"></table>
<script type="text/javascript" charset="utf-8">
<!--

jQuery(document).ready(function() {

jQuery("#<?php echo $id_table; ?>").flexigrid
(
{
url: <?php echo $options['jsonUrl']; ?>,
dataType: 'json',
<?php echo $aoColumns; ?>
searchitems : [{display: Drupal.t('ALL'), name : '*', isdefault: true}],
sortname: "<?php echo $sortField; ?>",
sortorder: "<?php echo $sortOrder; ?>",
usepager: true,
<?php if ($title)
	echo "title: '" . $title . "',"
?>
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: <?php echo "'$tableWidth'"; ?>,
height: <?php echo "'$tableHeight'"; ?>,
tableId: '<?php echo $id_table; ?>'
});
<?php if (isset($options['rowClick']))
	echo $options['rowClickHandler'];
?>

});

-->
</script>
<commit_msg>changed to work with static data<commit_after><?php
/**
 * Template file for datatable theme
 * Using jQuery plugins DataTables
 *
 * @author Naturwerk, 2011
 * @author <NAME>, 2012
 */

drupal_add_library('system', 'ui.datepicker');

/**
 * add css-file
 */
drupal_add_css(
	drupal_get_path('module', 'datatable') . '/css/flexigrid.css',
	array(
			'group' => CSS_DEFAULT,
			'every_page' => TRUE
	));

/**
 * add javascript files
 */
drupal_add_js(drupal_get_path('module', 'datatable') . '/js/flexigrid.js');
drupal_add_js(
	drupal_get_path('module', 'datatable') . '/js/lib/jquery.cookie.js');

/**
 * Figure out width/height of table or set default values
 */
if (isset($options['tableWidth']) && is_int($options['tableWidth'])) {
	$tableWidth = $options['tableWidth'];
} else {
	$tableWidth = 950;
}
if (isset($options['tableHeight']) && is_int($options['tableHeight'])
		&& $options['tableHeight'] > 0) {
	$tableHeight = $options['tableHeight'];
} else {
	$tableHeight = 200;
}

/**
 * Render the headers and columns
 */
if ($header) {
	$aoColumns = "colModel : [";
	$headers = array();
	$sortField = $header[0]['dbfield'];
	$sortOrder = "asc";

	foreach ($header as $head) {
		$aoColumns .= "{ display: '" . $head['name'] . "'";
		$aoColumns .= ", name : '" . $head['dbfield'] . "'";
		if (isset($head['noSort']) && $head['noSort'] == true) {
			$aoColumns .= ", sortable : false";
		} else {
			$aoColumns .= ", sortable : true";
		}
		assert($head['width']);
		$aoColumns .= ", width : '" . $head['width'] . "'";

		(isset($head['align']) && $head['align']) ? $aoColumns .= ",  align : '"
						. 9333 . "'"
				: $aoColumns .= ",  align : 'left'";

		if (isset($head['hide']) && $head['hide'] == true)
			$aoColumns .= ", hide : true";

		if (isset($options['rowClick']))
			$aoColumns .= ", process : " . $options['rowClick'];
		$aoColumns .= "},";
		$headers[] = $head['name'];
		if (isset($head['initSort']) && $head['initSort'] == true)
			$sortField = $head['dbfield'];
		if (isset($head['sortOrder']) && $head['sortOrder'])
			$sortOrder = $head['sortOrder'];
	}

	// remove trailing comma
	$aoColumns = substr_replace($aoColumns, "", -1);
	$aoColumns .= "],";

	if($rows){
		foreach ($header as $head) $table_headers[] = $head['name'];
	}
}
$table[$id_table] = array(
		'#theme' => 'table',
		'#header' => $table_headers,
		'#rows' => $rows,
		'#sticky' => false,
		'#attributes' => array('id' => $id_table),
);
print drupal_render($table);
?>

<script type="text/javascript" charset="utf-8">
<!--

jQuery(document).ready(function() {

jQuery("#<?php echo $id_table; ?>").flexigrid
(
{
<?php
if($options['jsonUrl']){
	echo "url: ".$options['jsonUrl'].", dataType: 'json',";
}
echo $aoColumns;
?>

searchitems : [{display: Drupal.t('ALL'), name : '*', isdefault: true}],
sortname: "<?php echo $sortField; ?>",
sortorder: "<?php echo $sortOrder; ?>",
usepager: true,
<?php if ($title)
	echo "title: '" . $title . "',"
?>
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: <?php echo "'$tableWidth'"; ?>,
height: <?php echo "'$tableHeight'"; ?>,
tableId: '<?php echo $id_table; ?>'
});
<?php if (isset($options['rowClick']))
	echo $options['rowClickHandler'];
?>

});

-->
</script>

{'fraction_non_alphanumeric': 0.24436151225052735, 'fraction_numerical': 0.007788414733084537, 'mean_word_length': 4.450044208664898, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 48, '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': '13665', 'n_tokens_mistral': 2336, 'n_tokens_neox': 2198, 'n_words': 455}