TotalCounter-Talk

Summary: Talk page for TotalCounter recipe

How can I set up a count file for every page

According to the notes on the recipe page, when the count file is too big, it creates some bug. A user suggested the following:

"my advice: store pageviews on each page instead!! overtones99 December 22, 2009, at 06:07 AM"

But I don't see in the documentation any ways to do this. Does anybody know how?

php 5.3

Function eregi() is deprecated in php 5.3 and causes errors. Scott Connard November 03, 2009, at 04:51 PM

  • fixed in version 1.10.0

umask gets changed

totalcounter_1_9_1 changes the umask value from PmWiki's normal 002 to 000 and does not reset it so ALL files changed by PmWiki end up with a chmod of 666 instead of 664. Scott Connard

Default page count separated into two counters

For some reason, I get my default page Portal.Portal counted separately, once as Portal.Portal (getting ca. 75 % of the hits on that page) and once as Portal/Portal (getting the remaining 25 %). The link generated by action=totalcount points to the same page for both variants, and the count displayed there is that listed under Portal.Portal. I've been unable to get the page displayed with the lower count indicated for Portal/Portal, so I'm a bit confused about the origin of the extra count. --Henning February 20, 2009, at 06:46 AM

Preventing Admin pageviews from getting counted

i haven't seen anyone mention how to prevent TotalCounter from logging when the admin views a page (when i edit and clean up the site, it causes the pagecounts to skyrocket artificially). i noticed that $TotalCounterBlacklist['Users'] = array('Admin'); or $TotalCounterBlacklist['Users'] = array('0'); don't seem to work, because i'm not using usernames / AuthUser, just passwords. here's the workaround that i figured out to prevent my admin edits from getting logged:

### place the following in config.php to prevent totalcounter from logging admin pageviews ###
## logic: turn totalcounter OFF if admin is viewing, unless admin is using the totalcounter action ##
if ( ( CondAuth($pagename,'admin')  &&  $action=="totalcounter" ) ||  !CondAuth($pagename,'admin') ) { 
    include_once('cookbook/totalcounter_1_9_1.php');
    } 

seem to work right. i wonder though if there's a better solution for this within the code itself, a way to add certain auth's to totalcount blacklist? overtones99 July 18, 2008, at 08:52 PM

I don't think that the above is actually working.
nikos? November 23, 2014, at 02:30 PM

totalcounter vars not working as expected

totalcounter's variables {$PageCount} and {$PageView} aren't working for me as i expect them to. here's what's up:

on a page, ALL of these end up spitting out the same exact value -- for the present page:

thispageCount: {$PageCount}
thispageViews: {$PageViews}
FAQ: {Main.FAQ$PageCount} - same thispage
IndexCount: {Main.Index$PageCount} - same as thispage
IndexViews: {UDP.Index$PageViews} - same as thispage

and actually, this is only after changing the following in the totalcounter.php:

//Markup('{$PageCount}', '<{$var}', '/\\{\\$PageCount\\}/e', $PageCount);
$FmtPV['$PageCount'] = "'$PageCount'";

otherwise, {Main.FAQ$PageCount} & {Main.Index$PageCount} don't print out anything...

anyone else have these issues, or a way to work around them? the idea is to be able to access the current count of pages that you're not currently viewing. thanks! overtones99 July 17, 2008, at 08:45 PM

DaveG 18-Feb-2009: Same problem here. Basically obtaining the pagecount/views for the current page in a pagelist doesn't seem possible.

Use {$PageCount} in footer?

Is there a possibility to use the variable {$PageCount} in a group-wide PageFooter file so that it shows the count for the main page above the footer and how would I do that?
I tried {*$PageCount} but that showed nothing.

Thanks, Harald? 2010-02-27

How to get totalcounter 1.9.1 to work with GeoIPCity?

2009-10-25 Hi there,

I tried to get TotalCounter to work with GeoIPCity (GeoIPCityLite to be precise). Here is how far I got with this project.

  • The I renamed the GeoLiteCity.dat to GeoIP.dat and saved it to the wiki.d directory.
  • The other GeoIP files needed are: geoipcity.inc, geoip.inc and geoipregionvars.php which I got from the http://geolite.maxmind.com/download/geoip/api/php/|MaxMind homepage as usual. I placed all those files in the cookbook/geoip directory. geoip.inc and geoipcity.inc do refer to each other in some way, so you need both files.
  • Next I changed the include directive in totalcounter.php at line 348 from
include ('geoip/geoip.inc');
to
include ('geoip/geoipcity.inc');
and added the line
include('geoip/geoipregionvars.php');
  • Now there was a little inconsistency: The geoip.inc tries to call the function "geoip_record_by_addr" which is defined in geoipcity.inc but with a slightly different name "GeoIP_record_by_addr". Therefore this function call had to be corrected in geoip.inc in the lines 364 and 379.
  • So, now the thing seems to work as usual. An exactly that's my problem! I don't know if the additional information about the city and so on are saved to the totalcounter.stat as I don't really understand how this file works. Furthermore the Totalcounter page of my pmwiki installation shows the country information as usual. But it still does not show the city information. Does anybody have an idea how to squeeze this additional functionality out of the Totalcounter?

Looking forward to your suggestions and ideas!

thanks bertwest

  • Problem with GeoIP: All files are in the right place and all variables are set to your best knowledge but TotalCounter is still not able to get the correct GeoIP information? Check if you have the correct capitalization of the Variable $TotalCounterEnableGeoIP in your config.php. Why do I mention that? Because I just copied the variable name from this Wiki Page and there, the capitalization was wrong.

version 1.9


April 10th 2008

Hi, I'm using the latest pmwiki version and the 1.9.1 TotalCounter version but the "Most Visited Pages" string doesn't work. (:pagelist group=GroupName count=10 fmt=#description order=$PageViews:) Does the {$PopularPagesItems} markup work or can you tell me the right string to show the 'most visited pages' correctly? Thanks in advance


I've just downloaded and installed the recipe[1]. Its just what I want, but some feedback and questions.

  • the default $TotalCounterAuthLevel prompted me for my admin password, rather than read as documented
  • would it be possible to provide a directive as well as a page action for total counter, so it can be embedded in a page?
If the directive provided a way of selecting singe report sections the page could be laid out as required
  1. Also I changed the line #1057 to '"<div class=\"TCprogress\" style=\"$direction:".Round(1+200*(($maxcount)? $count/$maxcount:0))."px;\"></div>"', because I got "division by zero" errors. /Aidin (added in 1.10.0)
  • It would be useful if the 'Last Day' report heading had '(hours)' added to it (added in 1.10.0)
thanks Simon

version 1.8+

  • After a while of flawless working, my counter V1.8 restarted counting. Can I get the old information back? The site in question :http://wiki.fali.nl/index.php/?action=totalcounter (it was around 35000 visitors :( ) Lighans
  • I would like to show the 'most popular pages' in the homepage but this (awesome) script doesn't yet support it. It wuold be great to show some stats in the homepage. Is this script going to be updated soon? Thanks in advance.
  • I just want to raise awareness that there is a potential for completely locking out a site that runs this recipe up to version 1.9 included. The issue and a potential fix are discussed here http://permalink.gmane.org/gmane.comp.web.wiki.pmwiki.user/46857 SteP November 04, 2007, at 03:13 AM
    • I can't read the page which is mentioned on the mailing list at this moment; but that's what I think should be done as for now: the potentially forever for-loop should be elliminated, and the file reading+writing part should be skipped if the lock could not be acquired. When you think about it, losing some visitors trace isn't so bad as having the site locked out. Moreover, there should be some code checking if the lock isn't quite old, and unlocking it should that happen. -- MateuszCzaplinski
  • Nice script! Since a week or so my totalcounter URL doesn't do anything. When browsing to http: <ip> / wiki/pmwiki/pmwiki.php/Main/Index?action=totalcounter I get the normal page, nothing else. No statistics. Just the same page as before but with a different URL. One thing that has changed is that I implemented clean URL's on my (IIS6) pmwiki. Any ideas? DJ -> mailto:pmwiki [snail] nldj [period] com (Aug-13-2007) --> Update: In the config.php include command I replaced the single-quotes like ' with double quotes like ". Now it works.
  • Somehow I have a user "0" in my statistic (Picture at the left) which is not listed in AuthUser. What does this mean? I was not able to find out when the counter for that user is increased.-- Matthias? June 08, 2007, at 11:12 AM
    • I have the same problem, any solution?-- Julien? June 20, 2007, at 1:05PM
    • I do have the same. Browsing through sources of pmwiki doesn't make clear for me what's the source of this value. My idea would be to try and change line 186 in TC 1.8a (213 in TC 1.9) from $tc_user = $_SESSION['authid'][0]; to $tc_user = @end($_SESSION['authid']); (the latter syntax is used somewhere in pmwiki.php). But I'm not sure enough to put it straight into TC source. MateuszCzaplinski October 02, 2007, at 07:56 AM
    • I have just set up a new wiki and the only person who knows about it is me. I also get a 0 in totalcounter, it might refer to when I am logged on as admin or editor. JamesM April 12, 2008, at 05:55 PM
  • Two ideas:
    • An option to exclude the top-scoring page would be nice. I get 4000 hits per day on the main portal page, and 300 on the second-ranking page, so all page counter bars except the one for the main portal page are just a few pixels wide. (I imagine that might affect most Wikis with hundreds or thousands of pages - the visitors just "fan out" from the portal.)
    • It might be useful to have an action like ?action=totalcountergroup that displays the statistics for the current group only so that authors of that group could have a de-cluttered perspective on exactly those pages they are responsible for.
  • Just my thoughts in case you`re looking for ways to put another layer of icing on the cake ;-) --Henning June 05, 2007, at 10:11 AM
  • How do I know that the GeoIP database is found and lookup is working ok? The lookups with $TotalCounterEnableLookup = 0;

$TotalCounterEnableGEOIP = 1; $TotalCounterGEOIP = "GeoIP.dat"; give ´unknown´ as a result for locations. When I enable Lookup the result is ´nl´. Any help/idea?

Make sure you have the GeoIP.dat file in your wiki.d directory. Also, make sure you are downloading the Country version of GeoIP.dat, as they also have a city location version as well. - Dave Carver
I had this issue as well, I have the country version of geoip.dat and it was in wiki.d, eventually the only way I solved it was to include absolute paths in the "include('geoip/geoip.inc');" statement, and in the $geoIpFile variable. Also for some reason, posting the $_SERVER['REMOTE_ADDR'] directly to the 'geoip_country_code_by_addr' function came up blank every time in tests, yet when I assigned it to a variable first (i.e.: $myvar = $_SERVER['REMOTE_ADDR']), and then gave $myvar to the geoip function, it worked. I'll debug some more later, and post if I come up with anything. - Tyler, 27/05/2007
  • I'm having a problem moving from tototalcounter version 1.5 to 1.8a. When I startup the newer version I lose all of my current counts that I have collected. All the counters are reset to 0. How do I maintain all of my old counts with the 1.8a version.
  • My copy of totalcounter is asking for a password. I am accessing it from a page which is password-protected to edit but not to read. Adding ?action=totalcounter requires a password to see the statistics. The site-wide admin password works but I don't want to give that to anyone. Could you give me a clue here, or document the authorization levels more?
    • Thanks! JMH, 3-7-07
    • In totalcounter.php, just change SDV($TotalCounterAuthLevel, 'admin'); to SDV($TotalCounterAuthLevel, 'read'); ~Mierk, May 11, 2007
It's not necessary (and also not advised) to change the totalcounter.php script. Just add $TotalCounterAuthLevel='read'; in the /local/config.php before including the TotalCounter recipe. It is also in the documentation.

Blues May 11, 2007, at 05:19 AM

  • Hello, is it possible to somehow modify TotalCounter to show the IP-Adresses instead of the User-Names? We are using PMWiki as a groupware without authentication, but still would like to have some statistics about who is mainly using it. Thanks a lot! ~Mierk, May 9, 2007

old comments (version < 1.8)

  • Is it possible/safe to edit .total.counter to remove totalcounter entries?
    Yes, it is possible. The file format, though, is quite tricky and may not be straightforward. I added above a note about it.

Blues February 08, 2006, at 08:58 AM

  • Wildcard for excluding file types not wanted in the totalcounter display.
Put this in totalcounter.php:
$TotalCounterBlacklist[Pages] = array('/.*.png/','/.*.ico/');
Stops *.png and *.ico. Same idea should work for *.css., *.jpg, etc.

DaveG February 8 2005

  • I want the page views not to be counted when it is a bot visit. But the wildcard does not work - Pageviews are still counted:
$TotalCounterBlacklist['Bots'] = array('/.+/');

uudo May 08, 2006, at 03:58 AM

  • I have no clue why I get the warnings below on top of every page I browse on my site when I am logged in!? I am using Authuser. I'd appreciate your help very much!
Warning: Illegal offset type in <my local root>/cookbook/totalcounter.php on line 279
Warning: Cannot modify header information - headers already sent by
(output started at <my local root>/cookbook/totalcounter.php:279)
in <my local root>/pmwiki.php on line 804

VolkerM 2006-02-19

Maybe new version (1.4b) will work?

Blues February 20, 2006, at 10:26 AM

Sorry, but unfortunately not. Now there is just the following error message now:
Parse error: syntax error, unexpected T_STRING
in <my local root>/cookbook/totalcounter.php on line 449
Strange enough I can not find any 'T_STRING' in the code, but I've to admit that I am not an experienced PHP programmer at all. ;-)

VolkerM 2006-02-20

How about now?

Blues February 21, 2006, at 03:19 AM

No, sorry, now I get a similar error messages as before on top of every page when being logged in (using AuthUser):
Warning: Illegal offset type in <my local root>/cookbook/totalcounter.php on line 283
Warning: Cannot modify header information - headers already sent by (output started
at <my local root>/cookbook/totalcounter.php:283)
in <my local root>/pmwiki.php on line 804
VolkerM 2006-02-21
Do I have to uninstall TotalCounter then? Would be a real pity, but the error messages are too annoying. :(

VolkerM 2006-02-27

If you haven't done it already, try adding include_once('scripts/authuser.php'); before including the TotalCounter recipe.

Blues February 27, 2006, at 09:38 AM

It has already been defined as you suggested. (I had tried to change the order of these definitions several times recently.) What I did now is to replace the authuser.php file by the very original from the installation archive. (I did that with pmwiki.php and others as well without being aware having modified them at any time in my running installation, but nevertheless...) The result is one single error message remaining right now on every page when a user with 'edit' authorization is logged in
Warning: Illegal offset type in <my local root>/cookbook/totalcounter.php on line 283
What can I do about that one?

VolkerM 2006-02-28

Usually I use UserAuth, so I tried a new installation of PmWiki using AuthUser and I don't get this error. Anybody else using AuthUser experiencing the same problem?

Blues March 02, 2006, at 08:07 AM

I did some more investigations and found the following:
$tc_user becomes an array when a authenticated user logs in.
According to the PHP description, an array can not be an index of an array, but it is the case in line 302.
Obviously this results in
Warning: Illegal offset type in <my local root>/cookbook/totalcounter.php on line 302
When adopting your example config
$TotalCounterBlacklist['Users'] = array('VolkerM','/^Author.*/');
additionally to the above the message
Warning: preg_match() expects parameter 2 to be string, array given
in <my local root>/cookbook/totalcounter.php on line 299
is displayed claiming that $tc_user is not a string. Maybe this helps?
Is it a PHP version (4.4.1 here) incompatibility issue? Has the data type control in PHP become more strict lately?

VolkerM 2006-03-09

I fixed the problem myself.
You'll find that my guess that there is a data type mismatch was right.
Therefore I corrected line 138 in totalcounter.php (version 1.5) to:
$tc_user = $_SESSION['authid'][0];
Now $tc_user is no longer been assigned an array (causing the error condition mentioned above) when an authenticated user logs in. Strange enough that noone else ran into this problem...!?

VolkerM 2006-03-09

  • I would love to use this, but I get this error:
Fatal error: Call to undefined function ResolvePageName() in C:\PHPdev\xampp\htdocs\bpt\cookbook\totalcounter.php on line 106
Update your PmWiki installation to the newest version (I don't remember exactly in which version the function was introduced).

Blues February 28, 2006, at 03:05 AM

  • Is there any way to prevent certain IP addresses from being logged? As the admin I frequently reload pages, edit, etc, and I don't want my messing around to artificially increase the page count view.

DaveG March 1, 2006, at 23:32 PM

Actually is not possible. If a specifc user (or location, or referer) is blacklisted, it will not be logged in the respective section, page views are not affected. I will think about it.

Blues March 02, 2006, at 04:02 AM

i figured out an easy way to prevent admin pageviews from being logged by simply not including the totalcounter script when the admin is viewing pages (with the one exception of when you're using action=totalcounter). see my comment above. overtones99 July 18, 2008, at 08:53 PM
  • Whilst I'm here, how about a few extra reports using the count data? Top x pages per group; page count for a specific page (so you don't increase the count by looking at the page); page coutns for 'favorite' pages, etc.

DaveG March 3, 2006, at 20:53 PM

The page count for a specific page can be retrieved using the new version (1.5). A new page variable is available, {$PageViews}, which can be used as a normal page variable. For example {MyPage$PageViews} gives the page views of the page MyPage.

Blues March 07, 2006, at 04:21 AM

  • Hi! Thanks for the great recipe. I seem to have the same server timeout problem mentioned in the archive. Looking more closely, I figured out that both .total.counter files are created in wiki.d/ with no write permission. Once this is corrected, I still have the same problem! Any ideas? I should mention that I am running it on a WikiFarm and am using PublishPDF recipe.
So I found the problem myself! I have PhP 4.2.2 on the server which doesn't have file_get_contents() and it just hangs after the first run! There is a workaround documented here.

Arshia Match 3, 2006

Thanks for pointing out the problem. Fixed in the new version (1.5).

Blues March 07, 2006, at 04:21 AM

  • It would be also nice to have an option showing the information of the (configurable) 10 last visits (IP Address, referer etc.)

Arshia Match 08, 2006.

  • Not really a major problem, but shouldn't line 123 of totalcounter.phpΔ be $tc_pagename=''; (single =)

Chris Morison? March 08, 2006, at 02:32 PM

Oh yes! You are correct! How that slipped there? Must be a copy-paste mistake :-) Thanks for finding it, and sorry for it. New version.

Blues March 09, 2006, at 03:01 AM

No problem. By the way, since you introduced the use of ResolvePageName in v1.4 - 31.01.2006, TotalCounter is no longer compatible with PmWiki versions before 2.1.beta21 - it counts every page as the default page. I'm still using 2.0.10, and until I get around to upgrading I have fixed this by replacing line 123 with $tc_pagename=str_replace('/','.',$pagename);. Great recipie though, thanks very much!
Also, if you're interested, I have hacked TotalCounter to ignore hits from various Editors of one of my sites even when not logged in by using a cookie. I did this by changing line 127 from:
if ($action=='browse') {
to:
$tc_ignore_cookie=$CookiePrefix.'_totalcounter_ignore';
if ($action==$TotalCounterAction.'_setcookie') {
setcookie($tc_ignore_cookie,'true',mktime(0,0,0,12,31,2037),'/');
}
$tc_cookie_set=(isset($_COOKIE[$tc_ignore_cookie]) && $_COOKIE[$tc_ignore_cookie]=='true');
if ($action=='browse' && !$tc_cookie_set) {
and line 277 from:
if (($action=='browse') && ($tc_pagename!='')) {
to:
if (($action=='browse') && ($tc_pagename!='') && !$tc_cookie_set) {
then any user that doesn't want their hits to be counted should visit a page with ?action=totalcounter_setcookie
I have also added code (using PHP Sessions) to only count visitors' first visit to each page and to only count their browser, Operating System, referer and location once per session. Search this file for 'Morison' to see my changes.

Chris Morison? March 09, 2006, at 03:41 AM


I have a few suggestion and made a totalcounter.php version with them see this script: a daily page counter, a short input field to set the $TotalCounterMaxItems. Changes I made have a ## comment. Maybe the script maintainer can review them. - Schlaefer March 09, 2006, at 07:07 AM


I propose a new browserstring (must be set before MS IE string):

 elseif (eregi('blazer',$_SERVER['HTTP_USER_AGENT'])) $tc_browser='Blazer';

The string for PalmOS should be changed from

 elseif (eregi('palmos',$_SERVER['HTTP_USER_AGENT'])) $tc_os='PalmOS';

to

 elseif (eregi('palm',$_SERVER['HTTP_USER_AGENT'])) $tc_os='PalmOS'; 

because newer devices identify as "PalmSource" or just "Palm"

Schlaefer March 10, 2006, at 10:21 AM


I propose a new browserstring

 elseif (eregi('arachne',$_SERVER['HTTP_USER_AGENT'])) $tc_browser='Arachne GPL';

New os-string:

 elseif (eregi('DOS',$_SERVER['HTTP_USER_AGENT'])) $tc_os='DOS';

Bug


V 1.9.2-PHP5.3.3

A little bug than generate an error with function filemtime on line 1190, in the function dblock_remove_stale. I propose this replace :

function dblock_remove_stale($wp) {

	$file = $wp.'.l';

	if(!empty($wp) && file_exists($file) && is_readable($file)) {

		$t=filemtime($file);

		// 75 minutes - to make absolutely sure we're not tricked by Daylight

		// Savings on Windows - see http://www.php.net/manual/en/function.stat.php#58404

		if( $t+(75*60) < time()) @unlink($file);

	}

}

theCName 2011.08.03 19:06


Sometimes the log-file seems to be destroyed or deleted, because it starts from "0".

Have the same problem too. But before fixing that we should bring the recent suggestions into the code. Is there a official maintainer for this recipe? - Schlaefer March 12, 2006, at 02:59 AM
I am the mantainer, I will include the suggestions into the code and release a new version.

Blues March 16, 2006, at 06:20 AM

Bug seems to be existing in version 1.6 too. Counters are reset at eastern on my page. - Micha April 19, 2006, at 02:11 AM
I've the same problem. It works some days and then it starts with 0. Looks like a automatic reset after some days, fist i thoght, it's a feature, ;-) would it be helpfull to send someone the .total.counter-file? CG, May 10, 2006

I am logged in, and set the variables, so that I shouldn't be counted. But...in increase...

Also a "user"-counter, not page-counter, would be good.

Many ideas :-)

flox March 10, 2006 <<<<<<<

Bug?

unofficial 1.6: Loggedin users sometimes not counted...maybe a cookie-problem?

flox April 10, 2006, at 09:53 AM

=======

Bug?

unofficial 1.6: Loggedin users sometimes not counted...maybe a cookie-problem?

flox April 10, 2006, at 09:48 AM

=======

Bug

I just found a small bug in V1.7 in line 746. The problem appears only if $TotalCounterAction is different to totalcounter. I cannot say whether this bug appears also in 1.6 (not checked).

see (:input form "$PageUrl?action=totalcounter" post:).
I have changed this section to (:input form "$PageUrl?action=$TotalCounterAction" post:).

That's all. Please modify this line for future versions. ;-)

Holger August 12, 2006, at 03:39 PM

>>>>>>>

Counter Reset?!

My Totalcounter (1.5) just got reseted tonight out of the blue! Do you have any idea why?!

Arshia May 23, 2006.

  • The resetting of the Counter file seems to happen when a user Aborts a page load. To avoid this, you may need to add a ignore_user_abort(true) call to the script, so that processing may continue in spite of a user abort of a page. This should be fixed in unofficial 1.8.

---KingArgyle, December 11, 2006.

Feature Idea - Google Search Terms

I have seen once a page, which has shown 'last google search that led to this page'. I suppose it was retrieved from the Referrer info, and it might be interesting if some kind of such statistics were added here.

TotalCounter and SimplePageCounter?

"$PageCount is the same that is used by the SimplePageCounter, so an upgrade to TotalCounter is possible without changing the markup (but will lose old counts). This also means that the two recipes cannot be used together (why to do it anyway?)."

I'd like to try TotalCounter with its vastly improved capabilities, but I have SimplePageCounter running and would not like to shut down the tried counter immediately, or lose the counts recorded so far. If I could run them in parallel, I'd be very happy. Maybe my question is naive, but is there a way to make the recipes non-exclusive by simply renaming a variable or something? --Henning August 30, 2006, at 07:34 AM

Most Visited Pages

Hi, I'm using your recipe, and I love it. But I've been trying to add a list of the most visited pages on the main page on my website. I added this line:

(:pagelist group=-PmWiki,-Category name=-Template,-GroupFooter count=10 fmt=#description order=PageViews:)

But It doesn't do the trick. Tried with and with "", {} and with the -. Could you tell me the correct syntax for this?

Try the dollar sign: order=$PageViews - should work. MateuszCzaplinski October 02, 2007, at 08:08 AM

~Moroni Granja
November 22, 2006, at 04:34 PM


Another problem:

Warning: chmod() [function.chmod]: Operation not permitted in /home/ttc/public_html/pmwiki/cookbook/totalcounter.php on line 1160
Warning: chmod() [function.chmod]: Operation not permitted in /home/ttc/public_html/pmwiki/cookbook/totalcounter.php on line 1171

Actual file permission is 0777.

simon April 07, 2010, at 04:48 AM

Has anyone noticed that non-breaking spaces display as their constituent characters when Totalcounter is plugged in. There's nothing else available, but non-breaking spaces can be used with tremendous effect in creating site-wide footer standards with multiple links, etc. If this one problem could be debugged, that would be a great service to PmWiki PHP developers.


Solved this by creating a php log, or errors, file. No more non-fatal errors messing up PmWiki pages. The Php Log file is very easy to create using this kit: http://coll-org-source.us/all-categories/Htaccess/scripts/error-log.zip Thanks! Jagtig


WARNING - i've discovered that as the totalcounter.stat file fills up, when it nears around 1MB in size, all of a sudden totalcounter stops working, and you get error msgs on your site. i think a function within it is timing-out or something. in addition, it becomes impossible to edit your totalcounter.stat file at this point b/c it's owned by 'nobody', and so trying to edit it as some other 'user' is impossible, as you don't have the right priviledges; plus, saving a new totalcounter.stat file is not an option unless you know to set $TotalCounterEnableChmods = 0, which when enabled, prevents totalcounter from writing to the totalcounter.stat file you created. kind of lame thing to discover 8 months into a medium-traffic site with hundreds of pages. am in the process of writing lots of Blacklists in order to prevent the cataloging of unnecessary pages, plus plan to write some blacklists to prevent the cataloging of other information that might be clogging the system - then cleaning out line-by-line from the old totalcounter.stat file. also - there seems to be no active maintenance of this recipe at the moment... beware : (

overtones99, 22 April 2009

My TotalCounter just stopped working at 647 KB count file size, too. Totalcounter 1.9.1, PmWiki 2.2.1, WindowsServer 2003, IIS. It had also stopped 4 weeks ago after counting for 4 weeks ... seems to be reproducable. --Henning April 27, 2009, at 06:33 AM

and now, somehow the totalcounter.stat file has overwritten itself several times over, so that all counts have been reset so many times (without my noticing it) that it'd be pointless to retrieve a backed up copy from 6 months ago... : ( my advice: store pageviews on each page instead!! overtones99 December 22, 2009, at 06:07 AM

SteP January 20, 2010, at 10:28 AM: I recall I had similar problems due to a locking issue. I know that version 1.9.1 fixed a locking issue, but I don't know if it's the same thing that I reported in wiki.pmwiki.user/46857. The person who wrote the locking code posted a fix on his board, but the link is now dead. I had saved the code, so I upload it as chozo4-fix.phpΔ. I didn't test it; it needs to be studied and integrated in the latest recipe code, but I stopped using TotalCounter since version 1.8a.
I had similar problems with TotalCounter locking up my whole site and difficult recovery. I really like the functionality it provides, but it's not worth the risk unless that problem is reliably reproduced and fixed. I stopped using this recipe around 1.9.2. Peter Bowers March 27, 2012, at 01:47 AM
Here's a "SimpleSimon" fix for the problems described on this page; no new coding, but it may require some doing, anyway.
  • 1. The problem is that new pages are added to the totalcounter.stat file by the script whether or not there is TotalCounter markup ({$PageViews}) on the page. Pages are added to the stat file when visited, even if it's just one webot visit. A few hundred pages will create a stat file that markedly slows down page opening, usually across the whole site, or even the entire server account, in some cases. So, I would suggest putting the config include in a group or page config customization file, and then restricting that to one or just a few pages. The file could be the site's gateway, with your most important keywords. I'm trying it out, now. -June 10, 2013

(Please see here about integrating GoogleCharts http://pmichaud.com/pipermail/pmwiki-users/2008-January/048443.html
Possibly a future version would integrate the code.) -- Luigi

I found that migrating from the 1.5 version to 1.8a that I lost all of my prior total counts. I saw no mention nor documentation that the files where the counts are persisted to was renamed. I found that to retain the prior version total counts you can do one of two things:

  1. Rename the old file names to the new names. This seems to be the better option because you do not have to maintain the change for future script versions.
  2. Change the 1.8a script to point to the old version named file.
Here are the file names for the different versions:
  • Version 1.5 :
    • $file = .total.counter
    • $lock = .total.counter.lock
  • Version :1.8a
    • $file = totalcounter.stat
    • $lock = totalcounter.lock

IchBin Profiles May 15, 2007, at 11:48 AM

Hmm; shouldn't the file names still start with a dot (in future versions of TC)? currently, when searching all pages (?action=search&q=/), a non-existent page named 'totalcounter.stat' is displayed because of the lack of the dot. Optionally, the filenames could be set using some configuration variables. MateuszCzaplinski October 02, 2007, at 02:13 PM

Talk page for the TotalCounter recipe (users).