An error occurred while processing the template.
?substring(...) argument #1 had invalid value: The index must be at least 0, but was -1.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign journalArticleId = themeDispl...  [in template "20099#20125#42396" at line 4, column 1]
----
1<#assign url = themeDisplay.getURLCurrent() 
2index = 0/> 
3 
4<#assign journalArticleId = themeDisplay.getURLCurrent()?substring(themeDisplay.getURLCurrent()?index_of("id="))+3/> 
5 
6 
7<#assign indexInizio = themeDisplay.getURLCurrent()?index_of("id=")+3> 
8<#assign indexFine= themeDisplay.getURLCurrent()?index_of("&from=")> 
9 
10<#if indexFine!=-1> 
11	<#assign journalArticleId = themeDisplay.getURLCurrent()?substring(indexInizio, indexFine)/> 
12	<#assign indexInizioFrom = themeDisplay.getURLCurrent()?index_of("from=")+5> 
13	<#assign provenienza = themeDisplay.getURLCurrent()?substring(indexInizioFrom)/> 
14</#if> 
15<#if indexFine==-1> 
16 
17<#assign indexBack= themeDisplay.getURLCurrent()?index_of("&back=")> 
18   
19		<#if indexBack!=-1> 
20		   <#assign backUrl="/web/csirt/notizie"> 
21			 <#assign provenienza ="Notizie"> 
22			 <#assign journalArticleId = themeDisplay.getURLCurrent()?substring(indexInizio, indexBack)> 
23		</#if> 
24		<#if indexBack==-1> 
25			<#assign journalArticleId = themeDisplay.getURLCurrent()?substring(indexInizio)> 
26		</#if> 
27</#if> 
28<!--NEWS --> 
29<#if journalArticleId?has_content> 
30 
31<#if entries?has_content> 
32	<#list entries as curEntry> 
33	  <#if curEntry.getEntryId() == journalArticleId?number> 
34 
35<#assign 
36		assetRenderer = curEntry.getAssetRenderer() 
37		entryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) 
38		docXml = saxReaderUtil.read(assetRenderer.getArticle().getContent()) 
39		dataCreazione = curEntry.getCreateDate()  
40		/> 
41		 
42 
43		<#assign fields = assetRenderer.getDDMFormValuesReader().getDDMFormValues().getDDMFormFieldValues()/> 
44					<#list fields as currentField> 
45									<#if currentField.getDDMFormField().getFieldReference()=='titolo'> 
46											<#assign titolo=currentField.getValue().getString(themeDisplay.getLocale()) /> 
47									</#if> 
48									<#if currentField.getDDMFormField().getFieldReference()=='areaDiTesto'> 
49											<#assign descrizione=currentField.getValue().getString(themeDisplay.getLocale()) /> 
50									</#if> 
51									<#if currentField.getDDMFormField().getFieldReference()=='dataPubblicazione'> 
52											<#assign dataPubblicazione=currentField.getValue().getString(themeDisplay.getLocale()) /> 
53									</#if> 
54									<#if currentField.getDDMFormField().getFieldReference()=='immagine'> 
55												<#assign image=currentField.getValue().getString(themeDisplay.getLocale()) /> 
56										<#assign imageObj = jsonFactoryUtil.createJSONObject(image) /> 
57									</#if> 
58					</#list> 
59 
60<#assign contacts = docXml.getRootElement()/> 
61<#assign categories =curEntry.getCategories()/> 
62 
63<main class="container ct-main"> 
64            <span class="subtitle"><img src="/o/CSIRTTema/images/svg/calendar.svg" alt="${languageUtil.get(locale, "label.ricerca.calendario")}">  
65						<#if (dataPubblicazione)??>${dataPubblicazione?datetime("yyyy-MM-dd")?string("dd MMMM yyyy")}</#if> 
66			</span> 
67            <h1 class="title"><#if (titolo)??>${titolo}</#if></h1> 
68             
69			<div id="ctNotizia"> 
70            <div class="cropped img-wrapper"> 
71							<img src="/documents/${imageObj.getString('groupId')}/${imageObj.getString('uuid')}" alt=""> 
72            </div> 
73            <div class="text-wrapper"> 
74                <#if (descrizione)??>${descrizione}</#if> 
75                 <div class="tags-wrap"> 
76				 <#list categories as category>     
77                    <div class="tag">${category.name}</div> 
78				 </#list> 
79                </div> 
80 
81 
82<#attempt> 
83<#assign fieldsAllegati = assetRenderer.getDDMFormValuesReader().getDDMFormValues().getDDMFormFieldValues()/> 
84				<#list fieldsAllegati as currentFieldAllegati> 
85													<#if currentFieldAllegati.getDDMFormField().getFieldReference()=='allegati'> 
86														<#assign imgObjAllegati = jsonFactoryUtil.createJSONObject(currentFieldAllegati.getValue().getString(themeDisplay.getLocale()))/> 
87														 <#if imgObjAllegati != "{}"> 
88																<div class="link-wrapper"> 
89																	 <a href="/documents/${imgObjAllegati.getString('groupId')}/${imgObjAllegati.getString('uuid')}" title="${imgObjAllegati.getString('title')}"  
90																			 target="blank" aria-label="${languageUtil.get(locale, "label.vaiallink")}" class="link">${imgObjAllegati.getString('title')} 
91																				<img src="/o/CSIRTTema/images/svg/icon-link.svg" alt="link"> 
92																		</a> 
93															</div> 
94														</#if> 
95												</#if> 
96											</#list> 
97										 <#recover> 
98									</#attempt> 
99 
100 
101            </div> 
102        </div> 
103</main> 
104				<#break> 
105</#if> 
106	</#list> 
107</#if> 
108</#if>