<commit_before>import codecs
import lala.config

from lala.util import _BOT, command, msg
from os.path import join

@command
def last(user, channel, text):
    """Show the last lines from the log"""
    max_lines = lala.config.get("max_lines", default=30)
    s_text = text.split()
    try:
        lines = min(max_lines, int(s_text[1]))
    except IndexError, e:
        lines = max_lines
    logfile = join(lala.config._get("base", "log_folder"), "lala.log")
    with codecs.open(logfile, "r", "utf-8") as _file:
        _lines = _file.readlines()
    lines = min(lines, len(_lines))
    for line in _lines[-lines:]:
        msg(user, line.replace("\n", ""), log=False)<commit_msg>plugins/last: Fix the calculation of the lines<commit_after>import codecs
import lala.config

from lala.util import _BOT, command, msg
from os.path import join

@command
def last(user, channel, text):
    """Show the last lines from the log"""
    max_lines = int(lala.config.get("max_lines", default=30))
    s_text = text.split()
    try:
        lines = min(max_lines, int(s_text[1]))
    except IndexError, e:
        lines = max_lines
    logfile = join(lala.config._get("base", "log_folder"), "lala.log")
    with codecs.open(logfile, "r", "utf-8") as _file:
        _lines = _file.readlines()
    lines = min(lines, len(_lines))
    for line in _lines[-lines:]:
        msg(user, line.replace("\n", ""), log=False)
{'fraction_non_alphanumeric': 0.1467236467236467, 'fraction_numerical': 0.005698005698005698, 'mean_word_length': 3.4462025316455698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1507898', 'n_tokens_mistral': 482, 'n_tokens_neox': 478, 'n_words': 129}