<commit_before>'use strict';

function CatBaseTabsController($scope, $controller, $routeParams, $location, config) {
    var endpoint = config.endpoint;

    $scope.tabs = config.tabs;
    $scope.tabNames = _.map(config.tabs, 'name');
    $scope.activeTab = {};

    $scope.activateTab = function (tab) {
        $scope.$broadcast('tab-' + tab + '-active');
        _.forEach($scope.tabs, function (currentTab) {
            $scope.activeTab[currentTab.name] = false;
        });
        $scope.activeTab[tab] = true;
    };

    $scope.selectTab = function (tabName) {
        $location.search('tab', tabName);
    };

    var isTabActive = function (tab) {
        return $routeParams.tab === tab.name;
    };

    $scope.$watchCollection(function () {
        return $location.search();
    }, function (newValue) {
        if (_.isString(newValue.tab)) {
            $scope.activateTab(newValue.tab);
        }
    });<commit_msg>always activate first tab if not defined, but don't put it into the url<commit_after>'use strict';

function CatBaseTabsController($scope, $controller, $routeParams, $location, config) {
    var endpoint = config.endpoint;

    $scope.tabs = config.tabs;
    $scope.tabNames = _.map(config.tabs, 'name');
    $scope.activeTab = {};

    $scope.activateTab = function (tab) {
        $scope.$broadcast('tab-' + tab + '-active');
        _.forEach($scope.tabs, function (currentTab) {
            $scope.activeTab[currentTab.name] = false;
        });
        $scope.activeTab[tab] = true;
    };

    $scope.selectTab = function (tabName) {
        if (_.isUndefined($location.search().tab) && tabName === $scope.tabNames[0]) {
            // don't add 'default' tab to url
            return;
        }
        $location.search('tab', tabName);
    };

    var isTabActive = function (tab) {
        if (tab.name === $scope.tabNames[0] && _.isUndefined($routeParams.tab)) {
            // first tab is active if no parameter is given
            return true;
        }
        return $routeParams.tab === tab.name;
    };

    $scope.$watchCollection(function () {
        return $location.search();
    }, function (newValue) {
        if (_.isString(newValue.tab)) {
            $scope.activateTab(newValue.tab);
        } else if (_.isUndefined(newValue.tab)) {
            // activate first tab if undefined
            $scope.activateTab($scope.tabNames[0]);
        }
    });
{'fraction_non_alphanumeric': 0.15403726708074533, 'fraction_numerical': 0.0012422360248447205, 'mean_word_length': 2.4124293785310735, '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': '3137265', 'n_tokens_mistral': 723, 'n_tokens_neox': 708, 'n_words': 148}