Don't output entities_json when linkifying text.

Use count variable, instead of calling count each time.