ALTER TABLE `stats` DROP `exec_time`, DROP `num_queries`;

ALTER TABLE `stats` CHANGE `search_terms` `country` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;

INSERT INTO `site_config` (
`id` ,
`config_key` ,
`config_value` ,
`config_description` ,
`availableValues` ,
`config_type` ,
`config_group`
)
VALUES (
NULL , 'enable_stats', 'yes', 'Enable statistics for each short url', '["yes", "no"]', 'select', 'Default'
);

INSERT INTO `language_key` VALUES (NULL, 'index_url_stats', 'Url Stats:', 0);
INSERT INTO `language_key` VALUES (NULL, 'index_url_stats_intro', 'For short url statistics, add an exclamation onto the end of the url', 0);

ALTER TABLE `stats` ADD `base_url` VARCHAR( 255 ) NOT NULL ;

INSERT INTO `language_key` VALUES (NULL, 'stats_page_name', 'Short Url Stats', 0);
INSERT INTO `language_key` VALUES (NULL, 'stats_meta_description', 'Statistics for short url', 0);
INSERT INTO `language_key` VALUES (NULL, 'stats_meta_keywords', 'statistics, stats, short, url, tiny, link, href', 0);
INSERT INTO `language_key` VALUES (NULL, 'visits_', 'visits:', 0);
INSERT INTO `language_key` VALUES (NULL, 'created_', 'created:', 0);
INSERT INTO `language_key` VALUES (NULL, 'visitors', 'Visitors', 0);
INSERT INTO `language_key` VALUES (NULL, 'countries', 'Countries', 0);
INSERT INTO `language_key` VALUES (NULL, 'top_referrers', 'Top Referrers', 0);
INSERT INTO `language_key` VALUES (NULL, 'browsers', 'Browsers', 0);
INSERT INTO `language_key` VALUES (NULL, 'operating_systems', 'Operating Systems', 0);
INSERT INTO `language_key` VALUES (NULL, 'last_24_hours', 'last 24 hours', 0);
INSERT INTO `language_key` VALUES (NULL, 'last_7_days', 'last 7 days', 0);
INSERT INTO `language_key` VALUES (NULL, 'last_30_days', 'last 30 days', 0);
INSERT INTO `language_key` VALUES (NULL, 'last_12_months', 'last 12 months', 0);
INSERT INTO `language_key` VALUES (NULL, 'hour', 'Hour', 0);
INSERT INTO `language_key` VALUES (NULL, 'visits', 'Visits', 0);
INSERT INTO `language_key` VALUES (NULL, 'date', 'Date', 0);
INSERT INTO `language_key` VALUES (NULL, 'total_visits', 'Total visits', 0);
INSERT INTO `language_key` VALUES (NULL, 'percentage', 'Percentage', 0);
INSERT INTO `language_key` VALUES (NULL, 'day', 'Day', 0);
INSERT INTO `language_key` VALUES (NULL, 'month', 'Month', 0);
INSERT INTO `language_key` VALUES (NULL, 'country', 'Country', 0);
INSERT INTO `language_key` VALUES (NULL, 'site', 'Site', 0);
INSERT INTO `language_key` VALUES (NULL, 'browser', 'Browser', 0);
INSERT INTO `language_key` VALUES (NULL, 'operating_system', 'Operating System', 0);

INSERT INTO `language_key` VALUES (NULL, 'AD', 'Andorra', 0);
INSERT INTO `language_key` VALUES (NULL, 'AE', 'United Arab Emirates', 0);
INSERT INTO `language_key` VALUES (NULL, 'AF', 'Afghanistan', 0);
INSERT INTO `language_key` VALUES (NULL, 'AG', 'Antigua And Barbuda', 0);
INSERT INTO `language_key` VALUES (NULL, 'AI', 'Anguilla', 0);
INSERT INTO `language_key` VALUES (NULL, 'AL', 'Albania', 0);
INSERT INTO `language_key` VALUES (NULL, 'AM', 'Armenia', 0);
INSERT INTO `language_key` VALUES (NULL, 'AN', 'Netherlands Antilles', 0);
INSERT INTO `language_key` VALUES (NULL, 'AO', 'Angola', 0);
INSERT INTO `language_key` VALUES (NULL, 'AQ', 'Antarctica', 0);
INSERT INTO `language_key` VALUES (NULL, 'AR', 'Argentina', 0);
INSERT INTO `language_key` VALUES (NULL, 'AS', 'American Samoa', 0);
INSERT INTO `language_key` VALUES (NULL, 'AT', 'Austria', 0);
INSERT INTO `language_key` VALUES (NULL, 'AU', 'Australia', 0);
INSERT INTO `language_key` VALUES (NULL, 'AW', 'Aruba', 0);
INSERT INTO `language_key` VALUES (NULL, 'AZ', 'Azerbaijan', 0);
INSERT INTO `language_key` VALUES (NULL, 'BA', 'Bosnia And Herzegovina', 0);
INSERT INTO `language_key` VALUES (NULL, 'BB', 'Barbados', 0);
INSERT INTO `language_key` VALUES (NULL, 'BD', 'Bangladesh', 0);
INSERT INTO `language_key` VALUES (NULL, 'BE', 'Belgium', 0);
INSERT INTO `language_key` VALUES (NULL, 'BF', 'Burkina Faso', 0);
INSERT INTO `language_key` VALUES (NULL, 'BG', 'Bulgaria', 0);
INSERT INTO `language_key` VALUES (NULL, 'BH', 'Bahrain', 0);
INSERT INTO `language_key` VALUES (NULL, 'BI', 'Burundi', 0);
INSERT INTO `language_key` VALUES (NULL, 'BJ', 'Benin', 0);
INSERT INTO `language_key` VALUES (NULL, 'BM', 'Bermuda', 0);
INSERT INTO `language_key` VALUES (NULL, 'BN', 'Brunei Darussalam', 0);
INSERT INTO `language_key` VALUES (NULL, 'BO', 'Bolivia', 0);
INSERT INTO `language_key` VALUES (NULL, 'BR', 'Brazil', 0);
INSERT INTO `language_key` VALUES (NULL, 'BS', 'Bahamas', 0);
INSERT INTO `language_key` VALUES (NULL, 'BT', 'Bhutan', 0);
INSERT INTO `language_key` VALUES (NULL, 'BW', 'Botswana', 0);
INSERT INTO `language_key` VALUES (NULL, 'BY', 'Belarus', 0);
INSERT INTO `language_key` VALUES (NULL, 'BZ', 'Belize', 0);
INSERT INTO `language_key` VALUES (NULL, 'CA', 'Canada', 0);
INSERT INTO `language_key` VALUES (NULL, 'CD', 'The Democratic Republic Of The Congo', 0);
INSERT INTO `language_key` VALUES (NULL, 'CF', 'Central African Republic', 0);
INSERT INTO `language_key` VALUES (NULL, 'CG', 'Congo', 0);
INSERT INTO `language_key` VALUES (NULL, 'CH', 'Switzerland', 0);
INSERT INTO `language_key` VALUES (NULL, 'CI', 'Cote Divoire', 0);
INSERT INTO `language_key` VALUES (NULL, 'CK', 'Cook Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'CL', 'Chile', 0);
INSERT INTO `language_key` VALUES (NULL, 'CM', 'Cameroon', 0);
INSERT INTO `language_key` VALUES (NULL, 'CN', 'China', 0);
INSERT INTO `language_key` VALUES (NULL, 'CO', 'Colombia', 0);
INSERT INTO `language_key` VALUES (NULL, 'CR', 'Costa Rica', 0);
INSERT INTO `language_key` VALUES (NULL, 'CS', 'Serbia And Montenegro', 0);
INSERT INTO `language_key` VALUES (NULL, 'CU', 'Cuba', 0);
INSERT INTO `language_key` VALUES (NULL, 'CV', 'Cape Verde', 0);
INSERT INTO `language_key` VALUES (NULL, 'CY', 'Cyprus', 0);
INSERT INTO `language_key` VALUES (NULL, 'CZ', 'Czech Republic', 0);
INSERT INTO `language_key` VALUES (NULL, 'DE', 'Germany', 0);
INSERT INTO `language_key` VALUES (NULL, 'DJ', 'Djibouti', 0);
INSERT INTO `language_key` VALUES (NULL, 'DK', 'Denmark', 0);
INSERT INTO `language_key` VALUES (NULL, 'DM', 'Dominica', 0);
INSERT INTO `language_key` VALUES (NULL, 'DO', 'Dominican Republic', 0);
INSERT INTO `language_key` VALUES (NULL, 'DZ', 'Algeria', 0);
INSERT INTO `language_key` VALUES (NULL, 'EC', 'Ecuador', 0);
INSERT INTO `language_key` VALUES (NULL, 'EE', 'Estonia', 0);
INSERT INTO `language_key` VALUES (NULL, 'EG', 'Egypt', 0);
INSERT INTO `language_key` VALUES (NULL, 'ER', 'Eritrea', 0);
INSERT INTO `language_key` VALUES (NULL, 'ES', 'Spain', 0);
INSERT INTO `language_key` VALUES (NULL, 'ET', 'Ethiopia', 0);
INSERT INTO `language_key` VALUES (NULL, 'EU', 'European Union', 0);
INSERT INTO `language_key` VALUES (NULL, 'FI', 'Finland', 0);
INSERT INTO `language_key` VALUES (NULL, 'FJ', 'Fiji', 0);
INSERT INTO `language_key` VALUES (NULL, 'FK', 'Falkland Islands (Malvinas)', 0);
INSERT INTO `language_key` VALUES (NULL, 'FM', 'Federated States Of Micronesia', 0);
INSERT INTO `language_key` VALUES (NULL, 'FO', 'Faroe Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'FR', 'France', 0);
INSERT INTO `language_key` VALUES (NULL, 'GA', 'Gabon', 0);
INSERT INTO `language_key` VALUES (NULL, 'GB', 'United Kingdom', 0);
INSERT INTO `language_key` VALUES (NULL, 'GD', 'Grenada', 0);
INSERT INTO `language_key` VALUES (NULL, 'GE', 'Georgia', 0);
INSERT INTO `language_key` VALUES (NULL, 'GF', 'French Guiana', 0);
INSERT INTO `language_key` VALUES (NULL, 'GH', 'Ghana', 0);
INSERT INTO `language_key` VALUES (NULL, 'GI', 'Gibraltar', 0);
INSERT INTO `language_key` VALUES (NULL, 'GL', 'Greenland', 0);
INSERT INTO `language_key` VALUES (NULL, 'GM', 'Gambia', 0);
INSERT INTO `language_key` VALUES (NULL, 'GN', 'Guinea', 0);
INSERT INTO `language_key` VALUES (NULL, 'GP', 'Guadeloupe', 0);
INSERT INTO `language_key` VALUES (NULL, 'GQ', 'Equatorial Guinea', 0);
INSERT INTO `language_key` VALUES (NULL, 'GR', 'Greece', 0);
INSERT INTO `language_key` VALUES (NULL, 'GS', 'South Georgia And The South Sandwich Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'GT', 'Guatemala', 0);
INSERT INTO `language_key` VALUES (NULL, 'GU', 'Guam', 0);
INSERT INTO `language_key` VALUES (NULL, 'GW', 'Guinea-Bissau', 0);
INSERT INTO `language_key` VALUES (NULL, 'GY', 'Guyana', 0);
INSERT INTO `language_key` VALUES (NULL, 'HK', 'Hong Kong', 0);
INSERT INTO `language_key` VALUES (NULL, 'HN', 'Honduras', 0);
INSERT INTO `language_key` VALUES (NULL, 'HR', 'Croatia', 0);
INSERT INTO `language_key` VALUES (NULL, 'HT', 'Haiti', 0);
INSERT INTO `language_key` VALUES (NULL, 'HU', 'Hungary', 0);
INSERT INTO `language_key` VALUES (NULL, 'ID', 'Indonesia', 0);
INSERT INTO `language_key` VALUES (NULL, 'IE', 'Ireland', 0);
INSERT INTO `language_key` VALUES (NULL, 'IL', 'Israel', 0);
INSERT INTO `language_key` VALUES (NULL, 'IN', 'India', 0);
INSERT INTO `language_key` VALUES (NULL, 'IO', 'British Indian Ocean Territory', 0);
INSERT INTO `language_key` VALUES (NULL, 'IQ', 'Iraq', 0);
INSERT INTO `language_key` VALUES (NULL, 'IR', 'Islamic Republic Of Iran', 0);
INSERT INTO `language_key` VALUES (NULL, 'IS', 'Iceland', 0);
INSERT INTO `language_key` VALUES (NULL, 'IT', 'Italy', 0);
INSERT INTO `language_key` VALUES (NULL, 'JM', 'Jamaica', 0);
INSERT INTO `language_key` VALUES (NULL, 'JO', 'Jordan', 0);
INSERT INTO `language_key` VALUES (NULL, 'JP', 'Japan', 0);
INSERT INTO `language_key` VALUES (NULL, 'KE', 'Kenya', 0);
INSERT INTO `language_key` VALUES (NULL, 'KG', 'Kyrgyzstan', 0);
INSERT INTO `language_key` VALUES (NULL, 'KH', 'Cambodia', 0);
INSERT INTO `language_key` VALUES (NULL, 'KI', 'Kiribati', 0);
INSERT INTO `language_key` VALUES (NULL, 'KM', 'Comoros', 0);
INSERT INTO `language_key` VALUES (NULL, 'KN', 'Saint Kitts And Nevis', 0);
INSERT INTO `language_key` VALUES (NULL, 'KR', 'Republic Of Korea', 0);
INSERT INTO `language_key` VALUES (NULL, 'KW', 'Kuwait', 0);
INSERT INTO `language_key` VALUES (NULL, 'KY', 'Cayman Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'KZ', 'Kazakhstan', 0);
INSERT INTO `language_key` VALUES (NULL, 'LA', 'Lao Peoples Democratic Republic', 0);
INSERT INTO `language_key` VALUES (NULL, 'LB', 'Lebanon', 0);
INSERT INTO `language_key` VALUES (NULL, 'LC', 'Saint Lucia', 0);
INSERT INTO `language_key` VALUES (NULL, 'LI', 'Liechtenstein', 0);
INSERT INTO `language_key` VALUES (NULL, 'LK', 'Sri Lanka', 0);
INSERT INTO `language_key` VALUES (NULL, 'LR', 'Liberia', 0);
INSERT INTO `language_key` VALUES (NULL, 'LS', 'Lesotho', 0);
INSERT INTO `language_key` VALUES (NULL, 'LT', 'Lithuania', 0);
INSERT INTO `language_key` VALUES (NULL, 'LU', 'Luxembourg', 0);
INSERT INTO `language_key` VALUES (NULL, 'LV', 'Latvia', 0);
INSERT INTO `language_key` VALUES (NULL, 'LY', 'Libyan Arab Jamahiriya', 0);
INSERT INTO `language_key` VALUES (NULL, 'MA', 'Morocco', 0);
INSERT INTO `language_key` VALUES (NULL, 'MC', 'Monaco', 0);
INSERT INTO `language_key` VALUES (NULL, 'MD', 'Republic Of Moldova', 0);
INSERT INTO `language_key` VALUES (NULL, 'MG', 'Madagascar', 0);
INSERT INTO `language_key` VALUES (NULL, 'MH', 'Marshall Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'MK', 'The Former Yugoslav Republic Of Macedonia', 0);
INSERT INTO `language_key` VALUES (NULL, 'ML', 'Mali', 0);
INSERT INTO `language_key` VALUES (NULL, 'MM', 'Myanmar', 0);
INSERT INTO `language_key` VALUES (NULL, 'MN', 'Mongolia', 0);
INSERT INTO `language_key` VALUES (NULL, 'MO', 'Macao', 0);
INSERT INTO `language_key` VALUES (NULL, 'MP', 'Northern Mariana Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'MQ', 'Martinique', 0);
INSERT INTO `language_key` VALUES (NULL, 'MR', 'Mauritania', 0);
INSERT INTO `language_key` VALUES (NULL, 'MT', 'Malta', 0);
INSERT INTO `language_key` VALUES (NULL, 'MU', 'Mauritius', 0);
INSERT INTO `language_key` VALUES (NULL, 'MV', 'Maldives', 0);
INSERT INTO `language_key` VALUES (NULL, 'MW', 'Malawi', 0);
INSERT INTO `language_key` VALUES (NULL, 'MX', 'Mexico', 0);
INSERT INTO `language_key` VALUES (NULL, 'MY', 'Malaysia', 0);
INSERT INTO `language_key` VALUES (NULL, 'MZ', 'Mozambique', 0);
INSERT INTO `language_key` VALUES (NULL, 'NA', 'Namibia', 0);
INSERT INTO `language_key` VALUES (NULL, 'NC', 'New Caledonia', 0);
INSERT INTO `language_key` VALUES (NULL, 'NE', 'Niger', 0);
INSERT INTO `language_key` VALUES (NULL, 'NF', 'Norfolk Island', 0);
INSERT INTO `language_key` VALUES (NULL, 'NG', 'Nigeria', 0);
INSERT INTO `language_key` VALUES (NULL, 'NI', 'Nicaragua', 0);
INSERT INTO `language_key` VALUES (NULL, 'NL', 'Netherlands', 0);
INSERT INTO `language_key` VALUES (NULL, 'NO', 'Norway', 0);
INSERT INTO `language_key` VALUES (NULL, 'NP', 'Nepal', 0);
INSERT INTO `language_key` VALUES (NULL, 'NR', 'Nauru', 0);
INSERT INTO `language_key` VALUES (NULL, 'NU', 'Niue', 0);
INSERT INTO `language_key` VALUES (NULL, 'NZ', 'New Zealand', 0);
INSERT INTO `language_key` VALUES (NULL, 'OM', 'Oman', 0);
INSERT INTO `language_key` VALUES (NULL, 'PA', 'Panama', 0);
INSERT INTO `language_key` VALUES (NULL, 'PE', 'Peru', 0);
INSERT INTO `language_key` VALUES (NULL, 'PF', 'French Polynesia', 0);
INSERT INTO `language_key` VALUES (NULL, 'PG', 'Papua New Guinea', 0);
INSERT INTO `language_key` VALUES (NULL, 'PH', 'Philippines', 0);
INSERT INTO `language_key` VALUES (NULL, 'PK', 'Pakistan', 0);
INSERT INTO `language_key` VALUES (NULL, 'PL', 'Poland', 0);
INSERT INTO `language_key` VALUES (NULL, 'PR', 'Puerto Rico', 0);
INSERT INTO `language_key` VALUES (NULL, 'PS', 'Palestinian Territory', 0);
INSERT INTO `language_key` VALUES (NULL, 'PT', 'Portugal', 0);
INSERT INTO `language_key` VALUES (NULL, 'PW', 'Palau', 0);
INSERT INTO `language_key` VALUES (NULL, 'PY', 'Paraguay', 0);
INSERT INTO `language_key` VALUES (NULL, 'QA', 'Qatar', 0);
INSERT INTO `language_key` VALUES (NULL, 'RE', 'Reunion', 0);
INSERT INTO `language_key` VALUES (NULL, 'RO', 'Romania', 0);
INSERT INTO `language_key` VALUES (NULL, 'RU', 'Russian Federation', 0);
INSERT INTO `language_key` VALUES (NULL, 'RW', 'Rwanda', 0);
INSERT INTO `language_key` VALUES (NULL, 'SA', 'Saudi Arabia', 0);
INSERT INTO `language_key` VALUES (NULL, 'SB', 'Solomon Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'SC', 'Seychelles', 0);
INSERT INTO `language_key` VALUES (NULL, 'SD', 'Sudan', 0);
INSERT INTO `language_key` VALUES (NULL, 'SE', 'Sweden', 0);
INSERT INTO `language_key` VALUES (NULL, 'SG', 'Singapore', 0);
INSERT INTO `language_key` VALUES (NULL, 'SI', 'Slovenia', 0);
INSERT INTO `language_key` VALUES (NULL, 'SK', 'Slovakia (Slovak Republic)', 0);
INSERT INTO `language_key` VALUES (NULL, 'SL', 'Sierra Leone', 0);
INSERT INTO `language_key` VALUES (NULL, 'SM', 'San Marino', 0);
INSERT INTO `language_key` VALUES (NULL, 'SN', 'Senegal', 0);
INSERT INTO `language_key` VALUES (NULL, 'SO', 'Somalia', 0);
INSERT INTO `language_key` VALUES (NULL, 'SR', 'Suriname', 0);
INSERT INTO `language_key` VALUES (NULL, 'ST', 'Sao Tome And Principe', 0);
INSERT INTO `language_key` VALUES (NULL, 'SV', 'El Salvador', 0);
INSERT INTO `language_key` VALUES (NULL, 'SY', 'Syrian Arab Republic', 0);
INSERT INTO `language_key` VALUES (NULL, 'SZ', 'Swaziland', 0);
INSERT INTO `language_key` VALUES (NULL, 'TD', 'Chad', 0);
INSERT INTO `language_key` VALUES (NULL, 'TF', 'French Southern Territories', 0);
INSERT INTO `language_key` VALUES (NULL, 'TG', 'Togo', 0);
INSERT INTO `language_key` VALUES (NULL, 'TH', 'Thailand', 0);
INSERT INTO `language_key` VALUES (NULL, 'TJ', 'Tajikistan', 0);
INSERT INTO `language_key` VALUES (NULL, 'TK', 'Tokelau', 0);
INSERT INTO `language_key` VALUES (NULL, 'TL', 'Timor-Leste', 0);
INSERT INTO `language_key` VALUES (NULL, 'TM', 'Turkmenistan', 0);
INSERT INTO `language_key` VALUES (NULL, 'TN', 'Tunisia', 0);
INSERT INTO `language_key` VALUES (NULL, 'TO', 'Tonga', 0);
INSERT INTO `language_key` VALUES (NULL, 'TR', 'Turkey', 0);
INSERT INTO `language_key` VALUES (NULL, 'TT', 'Trinidad And Tobago', 0);
INSERT INTO `language_key` VALUES (NULL, 'TV', 'Tuvalu', 0);
INSERT INTO `language_key` VALUES (NULL, 'TW', 'Taiwan Province Of China', 0);
INSERT INTO `language_key` VALUES (NULL, 'TZ', 'United Republic Of Tanzania', 0);
INSERT INTO `language_key` VALUES (NULL, 'UA', 'Ukraine', 0);
INSERT INTO `language_key` VALUES (NULL, 'UG', 'Uganda', 0);
INSERT INTO `language_key` VALUES (NULL, 'US', 'United States', 0);
INSERT INTO `language_key` VALUES (NULL, 'UY', 'Uruguay', 0);
INSERT INTO `language_key` VALUES (NULL, 'UZ', 'Uzbekistan', 0);
INSERT INTO `language_key` VALUES (NULL, 'VA', 'Holy See (Vatican City State)', 0);
INSERT INTO `language_key` VALUES (NULL, 'VC', 'Saint Vincent And The Grenadines', 0);
INSERT INTO `language_key` VALUES (NULL, 'VE', 'Venezuela', 0);
INSERT INTO `language_key` VALUES (NULL, 'VG', 'Virgin Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'VI', 'Virgin Islands', 0);
INSERT INTO `language_key` VALUES (NULL, 'VN', 'Viet Nam', 0);
INSERT INTO `language_key` VALUES (NULL, 'VU', 'Vanuatu', 0);
INSERT INTO `language_key` VALUES (NULL, 'WS', 'Samoa', 0);
INSERT INTO `language_key` VALUES (NULL, 'YE', 'Yemen', 0);
INSERT INTO `language_key` VALUES (NULL, 'YT', 'Mayotte', 0);
INSERT INTO `language_key` VALUES (NULL, 'YU', 'Serbia And Montenegro (Formally Yugoslavia)', 0);
INSERT INTO `language_key` VALUES (NULL, 'ZA', 'South Africa', 0);
INSERT INTO `language_key` VALUES (NULL, 'ZM', 'Zambia', 0);
INSERT INTO `language_key` VALUES (NULL, 'ZW', 'Zimbabwe', 0);
INSERT INTO `language_key` VALUES (NULL, 'ZZ', 'Unknown', 0);