Limit the number of lines to MAX_LINES