<commit_before><?php

/**
 *  Filebrowser
 */
class Filebrowser {
  var $config_name    = "filebrowser";

  var $path           = "";

  var $folder         = "";
  var $fullfolderpath = "";

  var $file           = "";
  var $filepath       = "";
  var $fullfilepath   = "";

  var $files          = array();

  var $properties     = array();

  var $updated_since  = "lastweek";

  var $sort_order           = "listingNameCmp";
  var $sort_order_direction = "Asc";

  var $displayed_content = false;

  var $filekind = null;

  public function __construct($config_name='filebrowser') {
    $this->config = Kohana::config($config_name);
    $this->config_name = $config_name;
    $this->filekind = FileKind::instance();

    $this->folder = $this->config['directory'];

    // check and update the updated_since settings
    $this->_updated_since();
    $this->_sort_order();
  }

  public function get_displayed_content() {
    return $this->displayed_content;
  }

  public function set_displayed_content($displayed) {
    $this->displayed_content = $displayed;
  }

  public function _sort_order() {
    $session= Session::instance();
    $sortFunction = "listingNameCmp";

    $currentSort = $session->get('sort_order');
    $currentSortOrder = $session->get('sort_order_direction');

    if (isset($_GET["sort"])) {
      if ($_GET["sort"] == "filename") {
        $sortFunction = "listingNameCmp";
      } else if ($_GET["sort"] == "size") {
        $sortFunction = "listingSizeCmp";
      } else if ($_GET["sort"] == "date") {
        $sortFunction = "listingDateCmp";
      } else if ($_GET["sort"] == "kind") {<commit_msg>Ticket #234: updated Filebrowser.php class attributes + _sort_order() to sort by date DESC by default<commit_after><?php

/**
 *  Filebrowser
 */
class Filebrowser {
  var $config_name    = "filebrowser";

  var $path           = "";

  var $folder         = "";
  var $fullfolderpath = "";

  var $file           = "";
  var $filepath       = "";
  var $fullfilepath   = "";

  var $files          = array();

  var $properties     = array();

  var $updated_since  = "lastweek";

  var $sort_order           = "listingDateCmp";
  var $sort_order_direction = "Desc";

  var $displayed_content = false;

  var $filekind = null;

  public function __construct($config_name='filebrowser') {
    $this->config = Kohana::config($config_name);
    $this->config_name = $config_name;
    $this->filekind = FileKind::instance();

    $this->folder = $this->config['directory'];

    // check and update the updated_since settings
    $this->_updated_since();
    $this->_sort_order();
  }

  public function get_displayed_content() {
    return $this->displayed_content;
  }

  public function set_displayed_content($displayed) {
    $this->displayed_content = $displayed;
  }

  public function _sort_order() {
    $session= Session::instance();
    $sortFunction = "listingDateCmp";

    $currentSort = $session->get('sort_order');
    $currentSortOrder = $session->get('sort_order_direction');

    if (isset($_GET["sort"])) {
      if ($_GET["sort"] == "filename") {
        $sortFunction = "listingNameCmp";
      } else if ($_GET["sort"] == "size") {
        $sortFunction = "listingSizeCmp";
      } else if ($_GET["sort"] == "date") {
        $sortFunction = "listingDateCmp";
      } else if ($_GET["sort"] == "kind") {
{'fraction_non_alphanumeric': 0.16104980614375186, 'fraction_numerical': 0.000894721145243066, 'mean_word_length': 3.0902439024390245, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '1074651', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1035, 'n_words': 219}