Total Hits und Visits
971580
protected function getTotal($VisitorsID)
	{
		$VisitorsTotalVisitCount = 0;
    	$VisitorsTotalHitCount   = 0;
	    if ($VisitorsID) 
	    {
    		//Total seit Zählung
    		$objVisitorsTotalCount = \Database::getInstance()
    		        ->prepare("SELECT 
                                    SUM(visitors_visit) AS SUMV, 
                                    SUM(visitors_hit) AS SUMH
                                FROM 
                                    tl_visitors_counter
                                WHERE 
                                    vid=?")
                    ->execute($VisitorsID);
    	    if ($objVisitorsTotalCount->numRows > 0) 
    	    {
    		    $objVisitorsTotalCount->next();
                $VisitorsTotalVisitCount = ($objVisitorsTotalCount->SUMV === null) ? 0 : $objVisitorsTotalCount->SUMV;
                $VisitorsTotalHitCount   = ($objVisitorsTotalCount->SUMH === null) ? 0 : $objVisitorsTotalCount->SUMH;
    	    }
	    }
	    return array('VisitorsTotalVisitCount' => $this->getFormattedNumber($VisitorsTotalVisitCount,0),
	                 'VisitorsTotalHitCount'   => $this->getFormattedNumber($VisitorsTotalHitCount,0)
	                );
	}
993447
public int getHitCount(IDbgpSession session) throws CoreException
	{
		final PerSessionInfo info;
		synchronized (sessions)
		{
			info = (PerSessionInfo) sessions.get(session);
		}
		return info != null ? info.hitCount : -1;
	}
704935
def stats(self, start_date=None, end_date=None, registered_only=False):
        
        pageviews = self.filter(
            visitor__start_time__lt=end_date,
            visitor__start_time__gte=start_date,
        ).select_related('visitor')

        stats = {
            'total': 0,
            'unique': 0,
        }

        stats['total'] = total_views = pageviews.count()
        unique_count = 0

        if not total_views:
            return stats

        # Registered user sessions
        registered_pageviews = pageviews.filter(visitor__user__isnull=False)
        registered_count = registered_pageviews.count()

        if registered_count:
            registered_unique_count = registered_pageviews.values(
                'visitor', 'url').distinct().count()

            # Update the total unique count...
            unique_count += registered_unique_count

            stats['registered'] = {
                'total': registered_count,
                'unique': registered_unique_count,
            }

        if TRACK_ANONYMOUS_USERS and not registered_only:
            guest_pageviews = pageviews.filter(visitor__user__isnull=True)
            guest_count = guest_pageviews.count()

            if guest_count:
                guest_unique_count = guest_pageviews.values(
                    'visitor', 'url').distinct().count()

                # Update the total unique count...
                unique_count += guest_unique_count

                stats['guests'] = {
                    'total': guest_count,
                    'unique': guest_unique_count,
                }

        # Finish setting the total visitor counts
        stats['unique'] = unique_count

        return stats
806133
def hit_groups(hits):
    
    groups = []
    current = False
    for hit in sorted(hits, key = itemgetter(0)):
        if current is False:
            current = [hit]
        elif check_overlap(current, hit) is True or check_order(current, hit) is False:
            groups.append(current)
            current = [hit]
        else:
            current.append(hit)
    groups.append(current)
    return groups
1032107
def _parse_hits(self, hits, resource):
        """"""
        datasource = self.get_datasource(resource)
        schema = {}
        schema.update(config.DOMAIN[datasource[0]].get('schema', {}))
        schema.update(config.DOMAIN[resource].get('schema', {}))
        dates = get_dates(schema)
        docs = []
        for hit in hits.get('hits', {}).get('hits', []):
            docs.append(format_doc(hit, schema, dates))
        return ElasticCursor(hits, docs)
644547
def total(self):
        """"""
        if self._result_cache:
            return self._result_cache.total

        return self.all().total
1029322
protected function setZero()
	{
	    if (false === $this->boolAllowReset)
	    {
	        return ;
	    }
	    $intCID = preg_replace('@\D@', '', \Input::get('zid')); //  only digits 
	    if ($intCID>0) 
	    {
	        // mal sehen ob ein Startdatum gesetzt war
    	    $objVisitorsDate = \Database::getInstance()
    	            ->prepare("SELECT 
                                    visitors_startdate 
                                FROM 
                                    tl_visitors 
                                WHERE 
                                    id=?")
                    ->execute($intCID);
    	    $objVisitorsDate->next();
    	    if (0 < (int)$objVisitorsDate->visitors_startdate) 
    	    {
    	        // ok es war eins gesetzt, dann setzen wir es wieder
                \Database::getInstance()
                        ->prepare("UPDATE tl_visitors 
                                    SET 
                                        tstamp=?, 
                                        visitors_startdate=? 
                                    WHERE 
                                        id=?")
                        ->execute( time(), strtotime(date('Y-m-d')), $intCID );
    	    }
    	    // und nun die eigendlichen counter
    	    \Database::getInstance()
    	            ->prepare("DELETE FROM tl_visitors_counter WHERE vid=?")
                    ->execute($intCID);
            \Database::getInstance()
                    ->prepare("DELETE FROM tl_visitors_blocker WHERE vid=?")
                    ->execute($intCID);
            \Database::getInstance()
                    ->prepare("DELETE FROM tl_visitors_browser WHERE vid=?")
                    ->execute($intCID);
            \Database::getInstance()
                    ->prepare("DELETE FROM tl_visitors_pages WHERE vid=?")
                    ->execute($intCID);
            \Database::getInstance()
                    ->prepare("DELETE FROM tl_visitors_screen_counter WHERE vid=?")
                    ->execute($intCID);
	    }
	    return ;
	}
294273
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this)) {
            target.visit(v);
            element.visit(v);
        }
    }
732148
def tracked(self, tag=None, fromdate=None, todate=None):
        
        return self.call("GET", "/stats/outbound/tracked", tag=tag, fromdate=fromdate, todate=todate)
238280
function addUpdated(results) {
  results.forEach(function(result) {
    result = normalizeResult(result);
    if (!lastQuery.results.hits) {
      lastQuery = { results: { hits: { total : 0, hits: [] } } };
    } else {
      var i = 0, l = lastQuery.results.hits.hits.length;
      for (i; i < l; i++) {
        if (lastQuery.results.hits.hits[i]._source.uri === result._source.uri) {
          lastQuery.results.hits.hits.splice(i, 1);
          break;
        }
      }
    }
    lastQuery.results.hits.hits.unshift(result);
  });
  updateResults(lastQuery);
}
387242
public Konto getOrderAccount() {
        // Checken, ob wir das Konto unter "My.[number/iban]" haben
        String prefix = this.getName() + ".My.";
        String number = this.getLowlevelParam(prefix + "number");
        String iban = this.getLowlevelParam(prefix + "iban");
        if ((number == null || number.length() == 0) && (iban == null || iban.length() == 0)) {
            // OK, vielleicht unter "KTV.[number/iban]"?
            prefix = this.getName() + ".KTV.";
            number = this.getLowlevelParam(prefix + "number");
            iban = this.getLowlevelParam(prefix + "iban");

            if ((number == null || number.length() == 0) && (iban == null || iban.length() == 0))
                return null; // definitiv kein Konto vorhanden
        }
        Konto k = new Konto();
        k.number = number;
        k.iban = iban;
        k.bic = this.getLowlevelParam(prefix + "bic");
        k.subnumber = this.getLowlevelParam(prefix + "subnumber");
        k.blz = this.getLowlevelParam(prefix + "KIK.blz");
        k.country = this.getLowlevelParam(prefix + "KIK.country");
        return k;
    }
138287
@SuppressWarnings({"unused", "WeakerAccess"})
    public int getTotalVisits() {
        EventDetail ed = getLocalDataStore().getEventDetail(Constants.APP_LAUNCHED_EVENT);
        if (ed != null) return ed.getCount();

        return 0;
    }
111674
public function collectStats()
    {
        Container::get('hooks')->fire('model.index.collect_stats_start');

        // Collect some statistics from the database
        if (!Container::get('cache')->isCached('users_info')) {
            Container::get('cache')->store('users_info', Cache::getUsersInfo());
        }

        $stats = Container::get('cache')->retrieve('users_info');

        $query = DB::forTable('forums')
            ->select_expr('SUM(num_topics)', 'total_topics')
            ->select_expr('SUM(num_posts)', 'total_posts');

        $query = Container::get('hooks')->fireDB('model.index.collect_stats_query', $query);

        $query = $query->find_one();

        $stats['total_topics'] = Utils::numberFormat((int)$query['total_topics']);
        $stats['total_posts'] = Utils::numberFormat((int)$query['total_posts']);

        if (User::get()->g_view_users == '1') {
            $stats['newest_user'] = '<a href="'.
                Router::pathFor('userProfile', ['id' => $stats['last_user']['id']]).'">'.
                Utils::escape($stats['last_user']['username']).'</a>';
        } else {
            $stats['newest_user'] = Utils::escape($stats['last_user']['username']);
        }
        $stats['total_users'] = Utils::numberFormat((int)$stats['total_users']);

        $stats = Container::get('hooks')->fire('model.index.collect_stats', $stats);

        return $stats;
    }
14901
function lastVisit()
    {
        $db = eZDB::instance();

        $userVisitArray = $db->arrayQuery( "SELECT last_visit_timestamp FROM ezuservisit WHERE user_id=$this->ContentObjectID" );
        if ( isset( $userVisitArray[0] ) )
        {
            return $userVisitArray[0]['last_visit_timestamp'];
        }
        else
        {
            return time();
        }
    }
70217
private void getHits() throws IOException
   {
      TopFieldCollector collector = TopFieldCollector.create(sort, numHits, false, true, false, false);
      searcher.search(query, collector);

      this.size = collector.getTotalHits();
      ScoreDoc[] docs = collector.topDocs().scoreDocs;
      for (int i = scoreDocs.size(); i < docs.length; i++)
      {
         scoreDocs.add(docs[i]);
      }
      log.debug("getHits() {}/{}", scoreDocs.size(), numHits);
      // double hits for next round
      numHits *= 2;
   }
283945
def num_pages(self):
        

        if self.count == 0 and not self.allow_empty_first_page:
            return 0

        hits = max(1, self.count - self.orphans)

        return int(ceil(hits / float(self.per_page)))
673526
def GetCountStopTimes(self):
    """"""
    cursor = self._schedule._connection.cursor()
    cursor.execute(
        'SELECT count(*) FROM stop_times WHERE trip_id=?', (self.trip_id,))
    return cursor.fetchone()[0]