// Check if there's a tag at the end of the last line
private boolean analyzeLastLine(
      PageAnalysis analysis, PageElementTag tag,
      Collection<CheckErrorResult> errors) {
    // TODO: Refactor
    // Check type of tag
    if (!HtmlTagType.CENTER.equals(tag.getType()) &&
        !HtmlTagType.SMALL.equals(tag.getType())) {
      return false;
    }
    // Check namespace
    Integer namespace = analysis.getPage().getNamespace();
    if ((namespace == null) || (namespace.intValue() == Namespace.TEMPLATE)) {
      return false;
    }
    // Go to the end of the last line
    String contents = analysis.getContents();
    int index = contents.length();
    while ((index > 0) && (contents.charAt(index - 1) == '\n')) {
      index--;
    }
    while ((index > 0) && (contents.charAt(index - 1) == ' ')) {
      index--;
    }
    if (index == 0) {
      return false;
    }
    // Check if there's a tag at the end of the last line
    int lastIndex = index;
    PageElementTag lastTag = null;
    if (contents.charAt(index - 1) == '>') {
      lastTag = analysis.isInTag(index - 1);
      if (lastTag != null) {
        index = lastTag.getBeginIndex();
      }
    }
    // Check if the tag is in the last line
    int tagEndIndex = tag.getEndIndex();
    while ((index > tagEndIndex) && (contents.charAt(index - 1) != '\n')) {
      index--;
      if (contents.charAt(index) == '>') {
        if (analysis.isInTag(index - 1, tag.getType()) != null) {
          return false;
        }
      }
    }
    if (index > tagEndIndex) {
      return false;
    }
    // Check if there's an other opening tag before in the page
    List<PageElementTag> tags = analysis.getTags(tag.getType());
    boolean after = false;
    boolean hasOtherTagBefore = false;
    for (PageElementTag otherTag : tags) {
      if (!after) {
        if (otherTag == tag) {
          after = true;
        } else if (!otherTag.isComplete()) {
          hasOtherTagBefore = true;
        }
      }
    }
    // Decide what to do
    if (lastTag == tag) {
      CheckErrorResult errorResult = createCheckErrorResult(analysis, tag.getBeginIndex(), tag.getEndIndex());
      errorResult.addReplacement("");
      if (hasOtherTagBefore && (tag.getParametersCount() == 0)) {
        errorResult.addReplacement(
            TagBuilder.from(tag.getName(), TagFormat.CLOSE).toString());
      }
      errors.add(errorResult);
      return true;
    }
    if (lastTag != null) {
      CheckErrorResult errorResult = analyzeArea(
          analysis, tag, lastTag.getBeginIndex(), tag.getEndIndex(),
          !hasOtherTagBefore, ActionAlone.ALONE_NOTHING); 
      if (errorResult != null) {
        errors.add(errorResult);
        return true;
      }
    } else {
      CheckErrorResult errorResult = analyzeArea(
          analysis, tag, tag.getBeginIndex(), lastIndex,
          !hasOtherTagBefore, ActionAlone.ALONE_NOTHING); 
      if (errorResult != null) {
        errors.add(errorResult);
        return true;
      }
    }
    return false;
  }
return false;
}
// Check if there's a tag at the end of the last line
int lastIndex = index;
PageElementTag lastTag = null;
int index = contents.length();
while ((index > 0) && (contents.charAt(index - 1) == '\n')) {
index--;
}
while ((index > 0) && (contents.charAt(index - 1) == ' ')) {
index--;
}
if (index == 0) {
return false;
}
// Check if there's a tag at the end of the last line
int lastIndex = index;
PageElementTag lastTag = null;
if (contents.charAt(index - 1) == '>') {
lastTag = analysis.isInTag(index - 1);
if (lastTag != null) {
index = lastTag.getBeginIndex();
}
}
// Check if the tag is in the last line
int tagEndIndex = tag.getEndIndex();
!HtmlTagType.SMALL.equals(tag.getType())) {
return false;
}
// Check namespace
Integer namespace = analysis.getPage().getNamespace();
if ((namespace == null) || (namespace.intValue() == Namespace.TEMPLATE)) {
return false;
}
// Go to the end of the last line
String contents = analysis.getContents();
int index = contents.length();
while ((index > 0) && (contents.charAt(index - 1) == '\n')) {
index--;
}
while ((index > 0) && (contents.charAt(index - 1) == ' ')) {
index--;
}
if (index == 0) {
return false;
}
// Check if there's a tag at the end of the last line
int lastIndex = index;
PageElementTag lastTag = null;
if (contents.charAt(index - 1) == '>') {
lastTag = analysis.isInTag(index - 1);
if (lastTag != null) {
index = lastTag.getBeginIndex();
}
}
// Check if the tag is in the last line
int tagEndIndex = tag.getEndIndex();
while ((index > tagEndIndex) && (contents.charAt(index - 1) != '\n')) {
index--;
if (contents.charAt(index) == '>') {
if (analysis.isInTag(index - 1, tag.getType()) != null) {
return false;
}
}
}
if (index > tagEndIndex) {
return false;