fix infinite loop

line 30 results in an infinite loop that will never terminate. i just had to fix this locally to get the server running.
Merge pull request #146 from FabianFrank/patch-1

fix infinite loop
Some more json_encode fixed for PHP < 5.2

From http://www.stetsenko.net/2009/09/php-json_encode-before-5-2-0/
Android devices have 16 character IDs, not 40.

This fixes stats collection on Android.
Merge pull request #147 from FabianFrank/patch-2

Android devices have 16 character IDs, not 40.
fix typo
Merge pull request #149 from FabianFrank/patch-3

fix typo