# -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2015 Scifabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PYBOSSA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with PYBOSSA.  If not, see <http://www.gnu.org/licenses/>.
"""Leaderboard view for PYBOSSA."""
from flask import Blueprint, current_app, request
from flask import render_template
from flask.ext.login import current_user
from pybossa.cache import users as cached_users
from pybossa.util import handle_content_type

blueprint = Blueprint('leaderboard', __name__)


@blueprint.route('/')
def index():
    """Get the last activity from users and projects."""
    window = 0
    if current_user.is_authenticated():
        user_id = current_user.id
    else:
        user_id = None
    if request.args.get('window'):
        window = int(request.args.get('window'))
    top_users = cached_users.get_leaderboard(current_app.config['LEADERBOARD'],
                                             user_id=user_id, 
                                             window=window)

    response = dict(template='/stats/index.html', title="Community Leaderboard",
                    top_users=top_users)
    return handle_content_type(response)

@@ -1330,16 +1330,59 @@
 ndow'))%0A
+%0A    if window %3E= 10:%0A        window = 10%0A%0A
     top_

Fix a max window.